Anders G. Nordby

Lead Consultant at Itera

Monthly Archives: December 2012

EPiServer Remote Events (CMS 6 R2)

Even though setting up remote events is an important topic, it’s actually hard to find much information on this. All I found were these posts:

The most important tool for the setup is the EPiServerRemoteEventsListener.zip, and I actually had to dig around a bit before I found it, so I present it for easy download here (WordPress doesn’t allow zip files – just change the file extension after download). Maybe I’m stupid, and it’s totally obvious to everyone else, but I had a couple of questions in my head that none of the above mentioned posts answered for me:

  1. What part of the configuration sets up the “sender” – the server sending information about site updates?
  2. What part of the configuration sets up the “receiver” – the server listening for new site updates?
  3. …and why did I keep getting errors when I tried the configs I thought would be correct?

Well, to anser question 3 fist, I realized that the EPiServerRemoteEventsListener tool must have a client config named RemoteEventServiceClientEndPoint, and that this client is the only one the tool actually uses (even if there are more clients defined in the config file). Obvious to some/most people, but could have saved me some time if it had been mentioned.

Question 1 & 2 are simple (but it took some experimentation before I knew I had understood this correctly):

  1. The service configuration is the receiver/listener.
  2. The client/clients configuration is/are the sender(s).

What I needed, was to have three servers exchange updates between them. I had at first thought I would do this with UDP broadcasts, but the network guys at the customer strongly suggested to use TCP against specific addresses. I asked if they wanted me to set things up using a specific port, but they said that the default port 808 would be fine. A good idea (which I was allowed to do) is to start by turning off all the local firewalls on the involved servers. When everything finally works, you can turn these on and configure them to let only the necessary information pass through.

The service section was the easiest to get correct, I simply used localhost as the address (and the default 808 port), meaning that this section is exactly the same on all three servers:

    <services>
      <service name="EPiServerRemoteEventsListener.RemoteEventListener" behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint"
                  contract="EPiServer.Events.ServiceModel.IEventReplication"
                  binding="netTcpBinding"
                  bindingConfiguration="RemoteEventsBinding"
                  address="net.tcp://localhost/RemoteEventService" />
      </service>
    </services>

The client section for each machine sets up the ability to send to the two other servers. Example, for Server03 i have the following:

    <client>
		<endpoint name="Server01" 
				contract="EPiServer.Events.ServiceModel.IEventReplication" 
				bindingConfiguration="RemoteEventsBinding" 
				address="net.tcp://...ip-address-of-server01.../RemoteEventService" 
				binding="netTcpBinding" />
		<endpoint name="Server02" 
				contract="EPiServer.Events.ServiceModel.IEventReplication" 
				bindingConfiguration="RemoteEventsBinding" 
				address="net.tcp://...ip-address-of-server02.../RemoteEventService" 
				binding="netTcpBinding" />
    </client>

Since the testing tool only works with the specific name RemoteEventServiceClientEndPoint, it’s easiest to make separate config files for this, and test sending/receiving for a pair of servers at a time. Hope this post makes it a little bit clearer how to set things up correctly! My final configuration for Server03 looks like this:

<configuration>
  <system.serviceModel>
    <services>
      <service name="EPiServerRemoteEventsListener.RemoteEventListener" behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint"
                  contract="EPiServer.Events.ServiceModel.IEventReplication"
                  binding="netTcpBinding"
                  bindingConfiguration="RemoteEventsBinding"
                  address="net.tcp://localhost/RemoteEventService" />
      </service>
    </services>
    <client>
		<endpoint name="Server01" 
				contract="EPiServer.Events.ServiceModel.IEventReplication" 
				bindingConfiguration="RemoteEventsBinding" 
				address="net.tcp://...server01-ip-address.../RemoteEventService" 
				binding="netTcpBinding" />
		<endpoint name="Server02" 
				contract="EPiServer.Events.ServiceModel.IEventReplication" 
				bindingConfiguration="RemoteEventsBinding" 
				address="net.tcp://...server02-ip-address.../RemoteEventService" 
				binding="netTcpBinding" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
    <netTcpBinding>
      <binding name="RemoteEventsBinding">
        <security mode="None" />
      </binding>
    </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Finally, remember that the DebugServiceBehaviour is for debug only… Don’t show exception details in your final release.

Update:
A really good blogpost on setting up load balancing: How to Configure EPiServer Load Balancing with net.tcp

Advertisements