Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Vladimir Terziyski
Sep 19, 2010
  8473
(0 votes)

EventReplication service with TCP

When dealing with multiple servers in load balancing scenario, you have to use EventReplication service in EPiServer in order to synchronize them. By default EPiServer comes with UDP synchronization but this won't work if multicast UDP is disabled by network administrators. The second options is to use TCP. If the version of EPiServer allows it you can enable port sharing:

   1: <bindings>
   2:     <nettcpbinding>
   3:         <binding name="PortBinding" portSharingEnabled="true" />
   4:     </nettcpbinding>
   5: </bindings> 
Here you can check more about specific implementation details: http://world.episerver.com/FAQ/Items/Multicast-UDP-not-working/
http://blog.fredrikhaglund.se/blog/2009/09/22/episerver-cms-how-to-configure-remote-events-with-many-servers-and-firewalls-between-them/

However when using specific ports for different endpoints, only one port per endpoint is allowed. If you set to endpoints to use the same port - the following exception will be thrown:
"System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted"
This exception can occur even when using different ports. Consider the following example:
I've created a page which has method that freezes the current thread for fifty seconds: Thread.Sleep(50000)
After the thread has been put to sleep, I've recycled the application pool manually. The next request which I've made to a different page in the same website returned the exception, which I've mentioned before. Why is this happening? There is feature in IIS 6 and IIS 7 called "overlapped recycling". When activated if application pool is recycled, the next request will create a new worker process (w3wp) even if the old one is not terminated yet. This way the two processes will try to use the same port.
By default the application pools is recycled every 1740 minutes. This means that if your website is performing long running operation after recycle the exception can be thrown. To disable overlapped recycling in IIS6 you have to set DisallowOverlappingRotation metabase property to true http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/24e3c22e-79a9-4f07-a407-dbd0e7f35432.mspx?mfr=true. In IIS7 select the application pool -> Advanced Settings -> Recycling section and set Disable Overlapped Recycling it to true. Also I recommend to set a specific time for recycling the website when it is less visited. This is because the worker process, which handles the request after recycle will wait for terminating the first one and is better to set it to a time when the website visit rate is lower. 

Sep 19, 2010

Comments

Sep 21, 2010 10:33 AM

Thanks!

Very interesting to know that this can happen. I think it applies both to the scenario when you use specific ports and port sharing since port sharing also requires a unique name of the end point (path changes instead of port number). Can you confirm?

/Fredrik

Sep 21, 2010 10:33 AM

Yes, you are right. Unique name of the end point is required per website. I've tried using the same end point in two websites and it failed with the following exception: "The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: the URI is already registered with the service"

Pankaj kr Prasad
Pankaj kr Prasad Mar 2, 2011 10:48 AM

Thanks!

I had same issue in one of the load balance site and the post was of great help.

Mar 14, 2012 08:35 PM

Me too Pankaj - nice to see you on here btw :)

Please login to comment.
Latest blogs
Azure AI Language – Extractive Summarisation in Optimizely CMS

In this article, I demonstrate how extractive summarisation, provided by the Azure AI Language platform, can be leveraged to produce a set of summa...

Anil Patel | Apr 26, 2024 | Syndicated blog

Optimizely Unit Testing Using CmsContentScaffolding Package

Introduction Unit tests shouldn't be created just for business logic, but also for the content and rules defined for content creation (available...

MilosR | Apr 26, 2024

Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024