Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Shahid nawaz
Oct 18, 2010
  7599
(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
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog