EPiWiki.se  - EPiServer notes shared with others
 

Load balancing over TCP

[Edit]
Sample configuration how to use remote events over TCP instead of UDP.

Why not using load balancing over TCP


- EPiServer is developed and tested for using UDP broadcast, and will work best with this configuration.
- TCP is a handshaking protocol and all WCF services are accessed in the same order as it given in web.config. This means that if several web services fail the last one is never accessed, and the remote events never reach that server.
Remote events over UDP

References


Event Management System Specification

This only works on EPiServer CMS R2 SP2 and above



Concept


The concept is the front server has to start a web service to listen to the CMS machine when it wants to remove some value from the cache.

It means that in the web.config on the front machine you have to start a listening service:

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

and on the CMS machine you have to connect to that service

<configuration>
   ...
    <client>
      <endpoint name="RemoteEventServiceClientEndPoint"
                address="net.tcp://<ip/name of Front>:1234/RemoteEventService"
                binding="netTcpBinding" bindingConfiguration="RemoteEventsBinding"
                contract="EPiServer.Events.ServiceModel.IEventReplication" />

If the front has to invalidate cached content on the CMS machine the CMS machine has to be set up as a service, and the front has to use that as a service.

Remarks


The port has to be opened in the firewall.
The events and remote events has to be enabled for the site
e.g. in web.config (or episerver.config)

      <siteSettings enableEvents="true"
                    enableRemoteEvents="true"


Load balancing multi site installations


When you load balancing a multi site installation you will get a error message “Port already in use” this can be solved with enable port sharing in web.config

<configuration>
  ...
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="RemoteEventsBinding" portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

Bug in CMS 6


#49896: Events System: Event Site not registered if WCF client section is empty or missing
There is a bug in CMS 6 that needs that the both client and server configuration exists on both the front and the backend server. If you want set up a configuration that the backend should only update the font you have to configure a dummy <client> configuration on the front server.

Example


Front configuration


IP: 10.0.0.10

<configuration>
  <site description="Example Site" siteId="TEST">
  ...
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="EventSubscriber"
           type="EPiServer.EventSubscriberHostModule, EPiServer"
           preCondition="managedHandler" />
...

<system.serviceModel>
  <services>
    <service
       name="EPiServer.Events.Remote.EventReplication"
       behaviorConfiguration="DebugServiceBehaviour">
      <endpoint
         name="RemoteEventServiceEndPoint"
         contract="EPiServer.Events.ServiceModel.IEventReplication"
         bindingConfiguration="RemoteEventsBinding"
         address="net.tcp://localhost:48000/RemoteEventService"
         binding="netTcpBinding" />
    </service>
  </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="RemoteEventsBinding">
            <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

Back-end configuration



<configuration>
  <site description="Example Site" siteId="TEST">
  ...

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="EventSubscriber"
           type="EPiServer.EventSubscriberHostModule, EPiServer"
           preCondition="managedHandler" />
...
  <system.serviceModel>
    <client>
      <endpoint
        name="RemoteEventServiceClientEndPoint1"
        contract="EPiServer.Events.ServiceModel.IEventReplication"
        bindingConfiguration="RemoteEventsBinding"
        address="net.tcp://10.0.0.10:48000/RemoteEventService"
        binding="netTcpBinding" />
    </client>
    <services>
      <service
        name="iiise/EPiServer.Events.Remote.EventReplication"
        behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint"
          contract="EPiServer.Events.ServiceModel.IEventReplication"
          bindingConfiguration="RemoteEventsBinding"
         address="net.tcp://localhost:48000/RemoteEventService"
         binding="netTcpBinding" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="RemoteEventsBinding">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>


Specifying a network when using UDP broadcast



<configuration>
  ....
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="RemoteEventsBinding">
          <udpTransport multicast="true" nicToUseName="VLAN 1000" />

Troubleshoot


Troubleshoot remote events
Version author:
Mattias Lövström

EPiServer version

'EPiServer CMS 5'