fredag 2 november 2012

EPiServer cache invalidation over net.tcp

I was recently struggling to get cache invalidation to work in EPiServer over net.tcp instead of UDP, which is default in EPiServer. There are a couple of good blog posts out there (for example http://blog.fredrikhaglund.se/blog/2009/09/22/episerver-cms-how-to-configure-remote-events-with-many-servers-and-firewalls-between-them/), and this post aims to clarify some aspects. I'm using EPiServer CMS 6 R2 on Windows Server 2008 R2 / IIS 7.5

First of all I want to configure the use of port sharing. This config should be applyed to all three web.configs:
<!-- In all three web.configs  -->
<system.serviceModel>   
    <bindings>
      <netTcpBinding>
        <binding name="RemoteEventsBinding"
                 portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

Then I want to configure the site used by the editors ie. the site that should publish events of updates to the other server:

<!-- web.config of the publisher site  -->
<system.serviceModel>
    <client>
      <endpoint name="WEBFRONT1"
                contract="EPiServer.Events.ServiceModel.IEventReplication"
                bindingConfiguration="RemoteEventsBinding"
                address="net.tcp://[SERVER1]/RemoteEventService1"
                binding="netTcpBinding" />

      <endpoint name="WEBFRONT2"
                contract="EPiServer.Events.ServiceModel.IEventReplication"
                bindingConfiguration="RemoteEventsBinding"
                address="net.tcp://[SERVER2]/RemoteEventService2"
                binding="netTcpBinding" />
    </client> 

The other two servers do not need any client configuration for the cache invalidation to work. They however needs some endpoints:
<!-- web.config of WEBFRONT1 (subscriber)  -->
<services>
      <service name="[EPiServerSiteIdWebFront1]/EPiServer.Events.Remote.EventReplication"
               behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint"
                  contract="EPiServer.Events.ServiceModel.IEventReplication"
                  bindingConfiguration="RemoteEventsBinding"
                  address="net.tcp://localhost/RemoteEventService1"
                  binding="netTcpBinding" />
      </service>

and:
<!-- web.config of WEBFRONT2 (subscriber)  -->
<services>
      <service name="[EPiServerSiteIdWebFront2]/EPiServer.Events.Remote.EventReplication"
               behaviorConfiguration="DebugServiceBehaviour">
        <endpoint name="RemoteEventServiceEndPoint"
                  contract="EPiServer.Events.ServiceModel.IEventReplication"
                  bindingConfiguration="RemoteEventsBinding"
                  address="net.tcp://localhost/RemoteEventService2"
                  binding="netTcpBinding" />
      </service>

[UPDATE: THIS IIS SECTION IS NOT NEEDED!]
And that's the only web.config needed! You do need to set two settings in the IIS of the to subscriber sites:
Site > Bindings...


Right-click the site in IIS > Manage Web Site > Advanced Settings...


[END UPDATE]

3 kommentarer:

  1. Thanks for the clarification! I've never seen the two last IIS changes anywhere though. Are you sure they are required to make it work?

    SvaraRadera
    Svar
    1. Hi John! Thank you for your comment! This is really strange, first I tried this without the IIS settings and it didn't work. Bu now when removing them it still works, so I guess you're right :) Updating the post, thanks!

      Radera
    2. Sorry, I meant Johan, not John :)

      Radera