• Publisert
  • 2 min

Mirroring in EPiServer CMS 5 R2 (5.2.375.236)

If the editor decide to delete a page om the source site, after an initial mirroring has been preformed on this page, the next mirroring will fail.

Giving this error message in the job status:

"The job failed: Exception has been thrown by the target of an invocation. [
Error executing Channel "News" Destination "MyEPiServerSite". Object reference not set to an instance of an object.]"

The EPiServer log file will have this output:

ERROR [1] EPiServer.Enterprise.Mirroring.MirroringManager.Execute - 10.1.6 Error executing Channel "News" Destination "MyEPiServerSite". Object reference not set to an instance of an object.
   at EPiServer.Enterprise.Mirroring.Destinations.PageMirroring.RemoveSuccessfullyMirroredPages(Object contentPackId, List`1 mirroredPages)
   ved EPiServer.Enterprise.Mirroring.Destinations.PageMirroring.SendQueue(MirroringInfo info, DestinationInfo pub)
   ved EPiServer.Enterprise.Mirroring.MirroringManager.Execute(MirroringInfo info)

The only workaround I have found is to either tell the editors not to delete pages that already has been mirrored, or if they decide to do so, they have to edit the morrring package queue under the Mirroring administration settings in admin mode after the next mirror job has run (and failed). The mirroring job will not succeed before the delete source page is delete from the package. This edited package will be picked up by the next mirroring job that runs.

The reversed situation, when a mirrored page is deleted in the destination site and mirroring is done to the same location, will also lead to an exception when the mirroring job is executed. The job status message will look something like this:


"The job failed: Exception has been thrown by the target of an invocation. [
Error executing Channel "News" Destination "MyEPiServerSite". The following errors occured:
Exception: Page "[770840bec81c4edfb7e40be355233841][[Public] News item][en]" does not exist anymore, removing link in pagelookup[]
]"
 
This however is reported as an bug and fixed in EPiServer CMS 6:  
Bug #28025: Exception when a mirrored page is deleted in the destination site and mirroring is done to the same location.

Regarding the file provider you are using: To enable successfull mirroring of files associated with the mirrored pages, the provider need to return a virtualfile object where the PermanentLinkVirtualPath property has a value. EPiServer.Web.Hosting.NativeFile.PermanentLinkVirtualPath f.ex. return null for this value. Thus using a provider that returns a virtualfile object of this type, no file will me mirrored. The solution might be to override the property like this:

 public override string PermanentLinkVirtualPath
        {
            get
            {
                return this.VirtualPath;
            }
        }

EPiCode.Web.Hosting.NativeFileEx (witch derive from NativeFile) also returned null for this property in its earliest version. I am concidering adding this override to the project on epicode. This will also fix the error returned on DataExport using this provider.