Configure events over WCF
Describes functional and technical information for the Microsoft Windows Communication Foundation (WCF)-based event provider.
Note
This content applies to Optimizely Content Management System (CMS) versions 10 and 11.
This provider supplies a model for object-oriented interface definitions and configurable inter-process communication methods without changing code. This provider is the default provider.
Configure the event system
The Optimizely event system distributes events between websites in a multi-site or load-balanced scenario. The configuration comprises two parts: subscriber and publisher. An Optimizely server can be a subscriber and publisher.
The Subscriber works as a WCF Server; configure it as a WCF Service. To configure the Optimizely Event System Subscriber, make the following checks or adjustments to the CMS web.config
file:
- In the <configuration> section, ensure the following
system.serviceModel
section exists, and insert the subscriber WCF Service element. Mandatory values are shown in the example (for example, contract name and name of WCF service), and the asterisk (*) indicates the custom value. See the Microsoft documentation about WCF 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>
- In the <configuration> section, ensure the following
system.serviceModel
section exists, and insert the subscriber WCF client element. The mandatory values are shown in the example (such as name and contract ), and the asterisk (*) indicates the customer value. See the Microsoft documentation about WCF configuration.<system.serviceModel> ... <client> <endpoint name="*" address="*" binding="*" bindingConfiguration="*" contract="EPiServer.Events.ServiceModel.IEventReplication" /> </client> </system.serviceModel>
Use UDP for remote events
An example configuration using UDP multicast. Use unique port numbers if you have multiple installations on the same network.
Note
UDP multicast is not supported in Azure Virtual Networks.
Code example for CMS 11.1 and higher:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<extensions>
<bindingElementExtensions>
<add name="udpTransportCustom"
type="Microsoft.ServiceModel.Samples.UdpTransportElement, EPiServer.Framework.AspNet"/>
</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>
<button class="button-toggle c-info-block__expand-button" onclick="ShowHideTextSection(this,'randomid_9cd231b1-9300-6037-711f-f202d0272f39')" data-dom-toggle="collapse">Code example for CMS 10.x</button>
<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>
Use TCP for remote events
An example configuration using TCP as the protocol. In the following 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 a unique configuration to expose one service and have multiple clients to communicate with 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>
Use a separate configuration file per IIS website
You can have different configurations for different IIS sites by moving the configuration to a separate file prefixed with the name of the IIS site followed by an underscore. This type of configuration is useful in the multi-site 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.
<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>
Use a separate service name per IIS website
You can have different configurations 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 or load-balanced scenario when sites share a physical path.
<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>
<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>
You can have different configurations 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.
<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>
<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>
Updated 7 months ago