Shahid nawaz
Oct 18, 2010
  7757
(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
How I Fixed DLL Conflicts During EPiServer CMS Upgrade to .NET Framework 4.8.1

We had a CMS solution of EPiServer 11.26.0, which was built on .NET Framework 4.7.1. We needed to update the target framework from .NET Framework...

calimat | Dec 12, 2024

Custom form element view in Optimizely CMS 12

Do you want full control over the form element markup? Create your own views!

Tomas Hensrud Gulla | Dec 11, 2024 | Syndicated blog

How to Elevate Your Experimentation - Opticon workshop experience

As a non-expert in the field of experimentation, I’d like to share my feedback on the recent Opticon San Antonio workshop session titled "How to...

David Ortiz | Dec 11, 2024

Persisting a Strawberry Shake GraphQL Client for Optimizely's Content Graph

A recent CMS project used Strawberry Shake to generate an up-to-date C# GraphQL client at each build. But what happens to the build if the GraphQL...

Nicholas Sideras | Dec 11, 2024 | Syndicated blog

Opti ID with Secure Cookies And Third Party AddOns

Opti ID has revolutionised access to the Optimizely One suite and is now the preferred authentication method on all PAAS CMS websites that I build....

Mark Stott | Dec 9, 2024

AsyncHelper can be considered harmful

.NET developers have been in the transition to move from synchronous APIs to asynchronous API. That was boosted a lot by await/async keyword of C#...

Quan Mai | Dec 4, 2024 | Syndicated blog