Question

I am having problems with Mulitcasting UDP can I change the configuration to be able to use the TCP protocol and point to specific servers instead of multicasting UDP?


Answer

Yes, see the example below - though please note that the standard behaviour in EPiServer CMS 5 is to use multbroadcast to get the servers to update their cache.

Configuration Example - Configuring the EventReplication service to use TCP

Below is an example of how to configure to a specific server using the tcp protocol. The first example uses a separate port for each site, the second example shows how to use port sharing. For further information about WCF please see the Microsoft documentation.

Server side

Use this to configure WCF Services (listens to incoming messages). Setup one service for each EPiServer site-tag.

  • Name should be unique.
  • Name must be the value of episerver/sites[siteid] plus "/EPiServer.Events.Remote.EventReplication", i.e. if siteId is “sss.se” then name should be “sss.se/EPiServer.Events.Remote.EventReplication”.
  • Each site must use a diffrent port in services/service/endpoint[address].
  • Use "localhost" in the address at

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

   <!-- Add additional service elements if you have an Enterprise installation,
        one for each site. Service name and endpoint addresses must be unique. -->
    <service
      name="sss.no/EPiServer.Events.Remote.EventReplication"
      behaviorConfiguration="DebugServiceBehaviour">
        <endpoint
           name="RemoteEventServiceEndPoint" 
           contract="EPiServer.Events.ServiceModel.IEventReplication" 
           bindingConfiguration="RemoteEventsBinding" 
           address="net.tcp://localhost:13001/RemoteEventService" 
           binding="netTcpBinding"/>
   </service>
</services>
...

 

Client side

And each server that changes the content must also be aware of where to send notifications so we must list all servers and websites.

  • Name should be unique.
  • It is better if address contains IP-addresses than hostnames.
  • There should be one endpoint for each website on a server where port number matches the ports used in the services/service/endpoint[address].

...
<client>
    <endpoint
      name="sss.se-SERVER1"
      address="net.tcp://SERVER1:13000/RemoteEventService"
      bindingConfiguration="RemoteEventsBinding"
      contract="EPiServer.Events.ServiceModel.IEventReplication"
      binding="netTcpBinding"/>
    <endpoint
      name="sss.se-SERVER2"
      address="net.tcp://SERVER2:13000/RemoteEventService"
      bindingConfiguration="RemoteEventsBinding"
      contract="EPiServer.Events.ServiceModel.IEventReplication"
      binding="netTcpBinding"/>

    <!-- Same as with server side configuration, if you have an Enterprise
         installation you need to add additional endpoints,
         one per site per server. -->
    <endpoint
      name="sss.no-SERVER1"
      address="net.tcp://SERVER1:13001/RemoteEventService"
      bindingConfiguration="RemoteEventsBinding"
      contract="EPiServer.Events.ServiceModel.IEventReplication"
      binding="netTcpBinding"/>
    <endpoint
      name="sss.no-SERVER2"
      address="net.tcp://SERVER2:13001/RemoteEventService"
      bindingConfiguration="RemoteEventsBinding"
      contract="EPiServer.Events.ServiceModel.IEventReplication"
      binding="netTcpBinding"/>
</client>
    ...

 

Behaviours and bindings

The option includeExceptionDetailInFaults should only be set to true in a test environment - in the production environment it should be set false.

...
<behaviors>
    <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
            <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
    </serviceBehaviors>
</behaviors>
<bindings>
    <netTcpBinding>
        <binding name="RemoteEventsBinding">
            <security mode="None" />
        </binding>
    </netTcpBinding>
</bindings>
    ...
 

Using port sharing

To use Net.TCP Port Sharing have to activate the service and adjust the configuration slightly.

Enable port sharing by modifying the netTcpBinding settings, add the portSharingEnabled attribute and set the value to true.

<bindings>
    <netTcpBinding>
        <binding name="PortBinding" portSharingEnabled="true">
            <security mode="None" />
        </binding>
    </netTcpBinding>
</bindings>

All  endpoint addresses, both server and client side, need to be changed.

<services>
    <service
      name="sss.se/EPiServer.Events.Remote.EventReplication" ... >
        <endpoint address="net.tcp://localhost/RemoteEventService1" ... />
    </service>
    <service 
      name="sss.no/EPiServer.Events.Remote.EventReplication" ... >
        <endpoint address="net.tcp://localhost/RemoteEventService2" ... />
    </service>
</services>

 

<client>
    <endpoint 
      name="sss.se-SERVER1"
      address="net.tcp://SERVER1/RemoteEventService1" ... />
    <endpoint
      name="sss.se-SERVER2"
      address="net.tcp://SERVER2/RemoteEventService1" ... />

    <endpoint 
      name="sss.no-SERVER1"
      address="net.tcp://SERVER1/RemoteEventService2" ... />
    <endpoint 
      name="sss.no-SERVER2"
      address="net.tcp://SERVER2/RemoteEventService2" ... />
</client>