Anders G. Nordby

Lead Consultant at Itera

Tag Archives: Mirroring 2.0

Setting up Mirroring 2.0 in a CMS 6 R2 Environment

It seems I’m not the only developer with only theoretical knowledge about Mirroring 2.0. Yes, I’ve read for the EPiServer Certified Developer exam, but I must admit I’ve never actually tried to set up Mirroring 2.0 before. Struggling with getting this to work, I found that many of my colleagues too had only theoretical knowledge; no hands-on experience. Granted, setting up Mirroring 2.0 is not something we do every day, but I was still a bit surprised at this lack of personal hands-on experience. The existing documentation is somewhat confusing and/or misleading, but make sure to start by reading through these anyway:

After lots of experimentation, I’ve finally got things to work. and will now show how to set up Mirroring 2.0 between to AlloyTech sites on the same machine.

First of all, get an Enterprise Demo License for your machine. Now, let’s begin:

Setting up the source site

  1. Add the line
    127.0.0.1    mirrorsource
    to your hosts file.
  2. Start EPiServer Deployment Center, and choose “Install site and SQL Server database”. We’ll now install a basic AlloyTech site called MirrorSource:
    MirrorSource_1MirrorSource_2MirrorSource_3MirrorSource_4MirrorSource_5MirrorSource_6
  3. Copy your License.config file to C:\EPiServer\Sites\MirrorSource
  4. In IIS, set the bindings for the site MirrorSource to point to http://mirrorsource on port 80.

Setting up the target site

  1. Add the line
    127.0.0.1    mirrortarget
    to your hosts file.
  2. Install a basic AlloyTech site called MirrorTarget (as above).
  3. Copy your License.config file to C:\EPiServer\Sites\MirrorTarget
  4. In IIS, set the bindings for the site MirrorTarget to point to http://mirrortarget on port 80.

The result so far

You should now have two basic AlloyTech sites, responding to http://mirrorsource and http://mirrortarget respectively. (If you have trouble getting this far, I think you should work more with basic EPiServer setup before moving on to mirroring…)

Installing the MirroringService

From the documentation, one easily gets the impression that the mirroring service should be installed only on the source site. However, it seems that the mirroring service must be installed on both servers. (I’ve tried only setting up the service on one server, and not been able to get this to work.)

First, update the hosts file with two more entries – the hosts file should now contain these entries:

127.0.0.1    mirrorsource
127.0.0.1    mirrorsourceService
127.0.0.1    mirrortarget
127.0.0.1    mirrortargetService

The installation of the MirroringService is similar for both sites (only showing installation for MirrorTarget site here).
I’ve no idea what credentials I’m supposed to be using, but at least the local administrator on my machine works fine:

InstallMirroring_1 InstallMirroring_2 InstallMirroring_3 InstallMirroring_4

In IIS, set the bindings for the mirroring services to point to http://mirrorsourceservice and http://mirrortargetservice, both on port 80.

The file EPiServer.Templates.AlloyTech.dll contains some code necessary for the mirroring to work. You’ll need to copy this file (from C:\EPiServer\Sites\MirrorSource\bin and C:\EPiServer\Sites\MirrorTarget\bin) to the service bin folders C:\EPiServer\Sites\MirrorSource\MirroringService\bin and C:\EPiServer\Sites\MirrorTarget\MirroringService\bin, otherwise you’ll get this error concerning unknown Dynamic Content later on:

DynamicContentErrorMessage

You now have no less than four Web.config files that need editing. In the two files for the source server, make a search/replace, changing http://MYMACHINENAME:17000 into http://mirrorsourceService, and for the two files for the target server change http://MYMACHINENAME:17000 into http://mirrortargetService. For clarity, here are some snippets:

C:\EPiServer\Sites\MirrorSource\Web.config

      <endpoint name="mirroringSourceEndpoint" address="http://mirrorsourceService/MirroringSourceServer.svc" binding="basicHttpBinding" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      <endpoint name="mirroringMonitoringEndPoint" address="http://mirrorsourceService/MirroringMonitoringServer.svc" bindingConfiguration="MonitoringMirroringBinding" binding="wsDualHttpBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />

C:\EPiServer\Sites\MirrorSource\MirroringService\Web.config

      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringSourceService.MirroringSourceServer">
        <endpoint address="http://mirrorsourceService/MirroringSourceServer.svc" binding="basicHttpBinding" name="mirroringSourceEndpoint" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      </service>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringTransferProtocol.MirroringTranferServer">
        <endpoint address="http://mirrorsourceService/MirroringTransferServer.svc" binding="basicHttpBinding" bindingConfiguration="MirroringBinding" name="mirroringTransferEndpoint" contract="EPiServer.MirroringService.MirroringTransferProtocol.Common.IMirroringDataTransfer" />
      </service>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringMonitoringService.MirroringMonitoringServer">
        <endpoint address="http://mirrorsourceService/MirroringMonitoringServer.svc" binding="wsDualHttpBinding" bindingConfiguration="MonitoringMirroringBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

C:\EPiServer\Sites\MirrorTarget\Web.config

      <endpoint name="mirroringSourceEndpoint" address="http://mirrortargetService/MirroringSourceServer.svc" binding="basicHttpBinding" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      <endpoint name="mirroringMonitoringEndPoint" address="http://mirrortargetService/MirroringMonitoringServer.svc" bindingConfiguration="MonitoringMirroringBinding" binding="wsDualHttpBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />

C:\EPiServer\Sites\MirrorTarget\MirroringService\Web.config

      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringSourceService.MirroringSourceServer">
        <endpoint address="http://mirrortargetService/MirroringSourceServer.svc" binding="basicHttpBinding" name="mirroringSourceEndpoint" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      </service>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringTransferProtocol.MirroringTranferServer">
        <endpoint address="http://mirrortargetService/MirroringTransferServer.svc" binding="basicHttpBinding" bindingConfiguration="MirroringBinding" name="mirroringTransferEndpoint" contract="EPiServer.MirroringService.MirroringTransferProtocol.Common.IMirroringDataTransfer" />
      </service>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringMonitoringService.MirroringMonitoringServer">
        <endpoint address="http://mirrortargetService/MirroringMonitoringServer.svc" binding="wsDualHttpBinding" bindingConfiguration="MonitoringMirroringBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

Setting up the Mirroring Channel

On the source machine, go to Admin Mode -> Config -> Tool Settings -> Mirroring, and click the Create button. Give the channel any name you like, set the URI to point to  http://mirrortargetService/MirroringTransferServer.svc, select a root node for the mirroring (I chose the Products page), and set the pageId for the destination page (I chose 8):

MirroringChannelSettings

Now it should be possible to actually run the Mirroring service. Go to Admin Mode -> Admin -> Scheduled Jobs -> Mirroring Service, and click the Start Manually button. On my machine, I’m granted with the following:

MirroringOK_1

Now go to Admin Mode -> Config -> Tool Settings -> Mirroring, and you’ll see the following:

MirroringOK_2

If you go to edit mode on the target site, you’ll see that the three pages under Products (from the source site) has been copied to the Company node of the target site:

MirroringResult

So, it seems that this works. I still don’t feel that I know all I need about Mirroring 2.0, but getting it to actually work was a big step in the right direction.

Advertisements