Try our conversational search powered by Generative AI!

Shahid nawaz
Oct 18, 2010
  7609
(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
Why C# Developers Should Embrace Node.js

Explore why C# developers should embrace Node.js especially with Optimizely's SaaS CMS on the horizon. Understand the shift towards agile web...

Andy Blyth | May 2, 2024 | Syndicated blog

Is Optimizely CMS PaaS the Preferred Choice?

As always, it depends. With it's comprehensive and proven support for complex business needs across various deployment scenarios, it fits very well...

Andy Blyth | May 2, 2024 | Syndicated blog

Adding market segment for Customized Commerce 14

Since v.14 of commerce, the old solution  for adding market segment to the url is not working anymore due to techinal changes of .NET Core. There i...

Oskar Zetterberg | May 2, 2024

Blazor components in Optimizely CMS admin/edit interface

Lab: Integrating Blazor Components into Various Aspects of Optimizely CMS admin/edit interface

Ove Lartelius | May 2, 2024 | Syndicated blog

Anonymous Tracking Across Devices with Optimizely ODP

An article by Lead Integration Developer, Daniel Copping In this article, I’ll describe how you can use the Optimizely Data Platform (ODP) to...

Daniel Copping | Apr 30, 2024 | Syndicated blog

Optimizely Forms - How to add extra data automatically into submission

Some words about Optimizely Forms Optimizely Forms is a built-in add-on by Optimizely development team that enables to create forms dynamically via...

Binh Nguyen Thi | Apr 29, 2024