Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely CMS
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Configuring events over WCF

Recommended reading 

This document contains functional and technical information for the Microsoft Windows Communication Foundation (WCF)-based event provider that provides a model for object-oriented interface definitions and configurable interprocess communication methods, without the need to change code. This provider is the default provider.

Configuring the event system

The EPiServer event system is used for distributing events between websites in a multi-site and/or load-balanced scenario. The configuration consists of two parts: subscriber and publisher. An EPiServer Server can be both subscriber and publisher.

The Subscriber works as a WCF Server, therefore configure it as WCF Service. To configure the EPiServer Event System Subscriber make the following checks/adjustment to the EPiServer CMS web.config file:

  1. In the <configuration> section ensure the following system.serviceModel section exists and insert the subscriber WCF Service element. The mandatory value are shown in the example (for example, contract name and name of WCF service) and the ‘*’ indicates the custom value. (Please see the microsoft documentation about WCF configuration for more info.)
    XML
    <system.serviceModel>
    ...
        <services>
           <service name="EPiServer.Events.Remote.EventReplication" 
                     behaviorConfiguration="*">
               <endpoint name="RemoteEventServiceEndPoint" 
                         contract="EPiServer.Events.ServiceModel.IEventReplication"
                         binding="*" address="*" />
           </service>
        </services>
    ...
    </system.serviceModel>
  2. In the <configuration> section ensure the following system.serviceModel section exists and insert the subscriber WCF client element. The mandatory value are shown in the example (for example, contract name) and the ‘*’ indicates the customer value. Refer to the Microsoft documentation about WCF configuration for more information.
    XML
    <system.serviceModel> 
    ... 
        <client> 
            <endpoint name="*" address="*" binding="*" bindingConfiguration="*" 
                      contract="EPiServer.Events.ServiceModel.IEventReplication" /> 
        </client> 
    </system.serviceModel>

Using UDP for remote events

An example configuration using UDP multi-cast, make sure to use unique port numbers if you have multiple installations on the same network:

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      <extensions>
        <bindingElementExtensions>
          <add name="udpTransportCustom" type="Microsoft.ServiceModel.Samples.UdpTransportElement, EPiServer.Events"/>
        </bindingElementExtensions>
      </extensions>
      <services>
        <service name="EPiServer.Events.Remote.EventReplication" >
        <endpoint name="RemoteEventServiceEndPoint"
                contract="EPiServer.Events.ServiceModel.IEventReplication"
                binding="customBinding"
                bindingConfiguration="RemoteEventsBinding"
                address="soap.udp://239.255.255.19:5000/RemoteEventService" />
        </service>
      </services>
      <client>
        <endpoint name="RemoteEventServiceClientEndPoint"
           address="soap.udp://239.255.255.19:5000/RemoteEventService"
           binding="customBinding"
           bindingConfiguration="RemoteEventsBinding"
           contract="EPiServer.Events.ServiceModel.IEventReplication" />
      </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <customBinding>
        <binding name="RemoteEventsBinding">
          <binaryMessageEncoding />
          <udpTransportCustom multicast="true"/>
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>

Using TCP for remote events

An example configuration using TCP as the protocol, in this example the server with IP 192.168.1.1 is configured to communicate with servers 192.168.1.2 and 192.168.1.3. Each server should have an unique configuration to expose 1 service and have multiple clients to communicate with all other servers.

Server 1 example:

<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
    	<service name="EPiServer.Events.Remote.EventReplication">
	      <endpoint
	      name="RemoteEventServiceEndPoint"
	      contract="EPiServer.Events.ServiceModel.IEventReplication"
	      bindingConfiguration="RemoteEventsBinding"
	      address="net.tcp://192.168.1.1:5000/RemoteEventService"
	      binding="netTcpBinding" />
	    </service>
    </services>
    <client>
      <endpoint name="192.168.1.2"
         address="net.tcp://192.168.1.2:5000/RemoteEventService"
         binding="netTcpBinding"
         bindingConfiguration="RemoteEventsBinding"
         contract="EPiServer.Events.ServiceModel.IEventReplication" />
      <endpoint name="192.168.1.3"
         address="net.tcp://192.168.1.3:5000/RemoteEventService"
         binding="netTcpBinding"
         bindingConfiguration="RemoteEventsBinding"
         contract="EPiServer.Events.ServiceModel.IEventReplication" />
    </client>
  <behaviors>
    <serviceBehaviors>
      <behavior name="DebugServiceBehaviour">
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
        <netTcpBinding>
        <binding name="RemoteEventsBinding" portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
  </bindings>
</system.serviceModel>

Using a separate configuration file per IIS web site

It is possible to have different configuration for different IIS sites by moving the configuration to a separate file prefixed with the name of the IIS site followed by a underscore. This type of configuration is useful in the multi-site and/or load-balanced scenario when sites share a physical path. Name the file [IIS web site name]_web.config where the name is the name of the IIS site.

XML
<configuration>
    <system.serviceModel>
    ...
        <services>
            <service name="EPiServer.Events.Remote.EventReplication" 
                         behaviorConfiguration="*">
                  <endpoint name="RemoteEventServiceEndPoint" 
                         contract="EPiServer.Events.ServiceModel.IEventReplication"
                         binding="*" address="*" />
            </service>
        </services>
    ...
    </system.serviceModel>
</configuration>

Using a separate service name per IIS web site

It is possible to have different configuration for different IIS sites by prefixing the name of the service with the name of the IIS site followed by a slash. This type of configuration is useful in the multi-site and/or load-balanced scenario when sites share a physical path.

XML
<system.serviceModel>
...
    <services>
       <service name="[IIS web site name 1]/EPiServer.Events.Remote.EventReplication" 
                 behaviorConfiguration="*">
           <endpoint name="RemoteEventServiceEndPoint" 
                     contract="EPiServer.Events.ServiceModel.IEventReplication"
                     binding="*" address="*" />
       </service>
    </services>

       <service name="[IIS web site name 2]/EPiServer.Events.Remote.EventReplication" 
                 behaviorConfiguration="*">
           <endpoint name="RemoteEventServiceEndPoint" 
                     contract="EPiServer.Events.ServiceModel.IEventReplication"
                     binding="*" address="*" />
       </service>
    </services>
...
 </system.serviceModel>

 
See also

Do you find this information helpful? Please log in to provide feedback.

Last updated: Jul 09, 2014

Recommended reading