Shahid nawaz
Oct 18, 2010
  7767
(2 votes)

Setting up Mirroring 2.0 in two ways

Since the launch of Mirroring 2.0, life has been made easy for EPiServer developers (Thanks to dev team). In this blog post I’ll try to share my experience when setting up mirroring between two sites. Since the mirroring service act as a separate application having its own appPool, you can also configure it in way so that more than one site(s) can use it as source/destination mirroring service. I’ll try to write configuration settings for two scenarios, one with using single mirroring service (installed only on source site) and second with using mirroring service installed both on source and destination sites.

1- Using Single Mirroring Service only on Source site:

Mirroring Service web.config which is installed on source site:

<configuration>
<connectionStrings>
    <clear />
    <add name="EPiServerDB1" connectionString="Data Source=SOURCE-PC\SQLEXPRESS;Initial Catalog=db5Up6;Integrated Security=False;User ID=dbUser5Up6;Password=asdfsa_ssdf98;" providerName="System.Data.SqlClient" />
</connectionStrings>
<add name="EPiServerDB2" connectionString="Data Source=Tareget-PC\SQLEXPRESS;Initial Catalog=dbmirrorcms6;Integrated Security=False;User ID=dbUsermirrorcms6;Password=CMS@123;Connect Timeout=10" providerName="System.Data.SqlClient" />
<episerverMirroring>
<mirroringTransfer defaultProvider="MirroringTransferServer">      <providers>
  <add destinationConnectionStringName="EPiServerDB2" defaultEndpointName="mirroringTargetEndPoint" chunkSize="4194304" name="MirroringTransferServer" type="EPiServer.MirroringService.MirroringTransferProtocol.WCF.MirroringTransferClient,EPiServer.Enterprise" username="epi" password="episerver" domain="" />
      </providers>
    </mirroringTransfer>
<services>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringSourceService.MirroringSourceServer">
        <endpoint address="http://source-pc:17000/MirroringSourceServer.svc" binding="basicHttpBinding" name="mirroringSourceEndpoint" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      </service>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringTransferProtocol.MirroringTranferServer">
        <endpoint address="http://source-pc:17000/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://source-pc:17000/MirroringMonitoringServer.svc" binding="wsDualHttpBinding" bindingConfiguration="MonitoringMirroringBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
</services>
<client>
       <endpoint address="http://source-pc:17000/MirroringTransferServer.svc" name="mirroringTargetEndPoint" binding="basicHttpBinding" bindingConfiguration="MirroringBinding" contract="EPiServer.MirroringService.MirroringTransferProtocol.Common.IMirroringDataTransfer" />

Source Site Web. Config changes:

<system.serviceModel>
    <client>
<endpoint name="mirroringSourceEndpoint" address="http://Source-pc:17000/MirroringSourceServer.svc" binding="basicHttpBinding" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
      <endpoint name="mirroringMonitoringEndPoint" address="http://source-pc:17000/MirroringMonitoringServer.svc" bindingConfiguration="MonitoringMirroringBinding" binding="wsDualHttpBinding" contract="EPiServer.MirroringService.MirroringMonitoring

 

Note: Enable the remote events as well based on your requirement either namedNet-Pipe or TCP/IP so that mirroring service can update the cache on target server.

 

2- When mirroring Service installed on both sites (Source & Destination).

Source Mirroring Service Web.Config:

<connectionStrings>
    <clear />
    <add name="EPiServerDB" connectionString="Data Source=Source-PC\SQLEXPRESS;Initial Catalog=db5Up6;Integrated Security=False;User ID=dbUser5Up6;Password=asdfsa_ssdf98;" providerName="System.Data.SqlClient" />
 </connectionStrings>
<services>
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringSourceService.MirroringSourceServer">
        <endpoint address="http://Source-pc:17001/MirroringSourceServer.svc" binding="basicHttpBinding" name="mirroringSourceEndpoint" contract="EPiServer.MirroringService.MirroringSourceService.IMirroringSource" />
</service>
      <!--no need of TragetMirroringServer here since we’have already installed Mirroring Service on Target site-->
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringMonitoringService.MirroringMonitoringServer">
        <endpoint address="http://Source-pc:17001/MirroringMonitoringServer.svc" binding="wsDualHttpBinding" bindingConfiguration="MonitoringMirroringBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
</services>
<client>
      <endpoint address="http://Target-pc:17006/MirroringTransferServer.svc" name="mirroringTargetEndPoint" binding="basicHttpBinding" bindingConfiguration="MirroringBinding" contract="EPiServer.MirroringService.MirroringTransferProtocol

Source Site Web.Config:

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

Target Mirroring Service Web.config:

 

<connectionStrings>
    <clear />
    <add name="EPiServerDB" connectionString="Data Source=Target-PC\SQLEXPRESS;Initial Catalog=dbtestsite;Integrated Security=False;User ID=dbUsertestsite;Password=asdf@954;" providerName="System.Data.SqlClient" />
</connectionStrings>
<services>
      <!--No need to have MirroringSourceServer and MirroringMonitoringServer available here since we are using both from Source Mirroing Service.-->
      <service behaviorConfiguration="MirroringServiceBehavior" name="EPiServer.MirroringService.MirroringTransferProtocol.MirroringTranferServer">
        <endpoint address="http://Target-PC:17006/MirroringTransferServer.svc" binding="basicHttpBinding" bindingConfiguration="MirroringBinding" name="mirroringTransferEndpoint" contract="EPiServer.MirroringService.MirroringTransferProtocol.Common.IMirroringDataTransfer" />
      </service>
 </services>
 <client>
      <!—no need to set MirroingTargetEndpoint here since we’ve already defined it in source mirroring service-->

Note: Enable the remote events as well based on your requirement either UDP or TCP/IP so that mirroring service can update the cache on target server.

 

Troubleshooting Mirroring Service:

You can enable regular EPiServer logging by placing EPiServerLog.Config to Mirroring Service root folder. Second option which I really like is to enable offLineLogging in mirroring service web. config as below:

<mirroringMonitoring offlineLoggingEnabled="true" offlineLogPath="C:\EPiServer\MyMirroringMonitoringData" />

Note1: Installing mirroring service 2.0 as virtual directory is not a supported solution.

Note2: Copy all needed (if you added custom property, module, plugin which will be part of mirroring) assemblies to Mirroring service bin folder otherwise you may get errors like "Value cannot be null"
Parameter name: type () 

Oct 18, 2010

Comments

Jan 18, 2011 02:16 PM

Hi,

Just a friendly reminder that if you have any dynamic content plugins you need to copy their dll's to the Mirroring service's bin folder for it to succeed mirroring it. Or else you will see something like this:

Exception has been thrown by the target of an invocation. [
Error executing task "Test Job": The Dynamic Content control type Quiz Item could not be loaded. Check the section in web.config. ()
]

adrian.smith@auros.co.uk
adrian.smith@auros.co.uk Aug 26, 2011 09:17 AM

This is a great post. It helped me enormously. Now I need to work out how to set up mirroring from a staging server to 2 live servers, each with their own database - any ideas?

Gunjan Kumar Jha
Gunjan Kumar Jha Nov 4, 2014 12:28 PM

Hi,While configuring content mirroring in my EPIserver CMS7 website i am getting an error message" Not possible to find sitesetting for content with reference".

I have configured mirroring in both the source and target site and both bin folders(root folder and content mirroring Bin folder) and their DLL's are identical.Any help will be highly appreciated.

ThanksGunjan

Please login to comment.
Latest blogs
Copy Optimizely SaaS CMS Settings to ENV Format Via Bookmarklet

Do you work with multiple Optimizely SaaS CMS instances? Use a bookmarklet to automatically copy them to your clipboard, ready to paste into your e...

Daniel Isaacs | Dec 22, 2024 | Syndicated blog

Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024

Simplify Optimizely CMS Configuration with JSON Schema

Optimizely CMS is a powerful and versatile platform for content management, offering extensive configuration options that allow developers to...

Hieu Nguyen | Dec 19, 2024

Useful Optimizely CMS Web Components

A list of useful Optimizely CMS components that can be used in add-ons.

Bartosz Sekula | Dec 18, 2024 | Syndicated blog