Shahid nawaz
Oct 18, 2010
  7703
(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
Integrating Optimizely DAM with Your Website

This article is the second in a series about integrating Optimizely DAM with websites. It discusses how to install the necessary package and code t...

Andrew Markham | Sep 28, 2024 | Syndicated blog

Opticon 2024 - highlights

I went to Opticon in Stockholm and here are my brief highlights based on the demos, presentations and roadmaps  Optimizely CMS SaaS will start to...

Daniel Ovaska | Sep 27, 2024

Required fields support in Optimizely Graph

It's been possible to have "required" properties (value must be entered) in the CMS for a long time. The required metadata haven't been reflected i...

Jonas Bergqvist | Sep 25, 2024

How to write a bespoke notification management system

Websites can be the perfect vehicle for notifying customers of important information quickly, whether it’s the latest offer, an operational message...

Nicole Drath | Sep 25, 2024

Optimizely DAM – An Introduction

I presented a talk about the Optimizely DAM at the OMVP summit during Opticon 2024 in Sweden. I have now converted that talk into two blog posts....

Andrew Markham | Sep 25, 2024 | Syndicated blog

Simple and Effective Personalization with Optimizely Data Platform (ODP)

As we dive into the amazing capabilities of Optimizely One, let’s shine a spotlight on the Optimizely Data Platform (ODP). This simple tool unifies...

Alex Harris - Perficient | Sep 24, 2024 | Syndicated blog