AddressAlreadyInUseException with TCP Event configuration

Member since: 2004

Hi all,

Having some troubles with getting TCP event communication going properly. Well, it works good, but every time the application needs to restart, for example when the web.config is saved I get the dreaded:

System.ServiceModel.AddressAlreadyInUseException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: the URI is already registered with the service.

It only last for between 20-60 sec, but that is enough for it to be an issue in production.

Portsharing is turned on and I have disabled overlapping application pool recycling.

The following is the service model config:

      <service name="TodayNetwork/EPiServer.Events.Remote.EventReplication">
        <endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" binding="netTcpBinding"
          bindingConfiguration="RemoteEventsBinding" address="net.tcp://localhost:13000/RemoteEventService"/>
      <service name="TripleMNetwork/EPiServer.Events.Remote.EventReplication">
        <endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" binding="netTcpBinding"
          bindingConfiguration="RemoteEventsBinding" address="net.tcp://localhost:13001/RemoteEventService"/>
      <service name="Dirt/EPiServer.Events.Remote.EventReplication">
        <endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" binding="netTcpBinding"
          bindingConfiguration="RemoteEventsBinding" address="net.tcp://localhost:13002/RemoteEventService"/>
      <endpoint name="TodayNetwork.PI" address="net.tcp://" binding="netTcpBinding"
        bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication"/>
      <endpoint name="TripleMNetwork.PI" address="net.tcp://" binding="netTcpBinding"
        bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication"/>
      <endpoint name="Dirt.PI" address="net.tcp://" binding="netTcpBinding" bindingConfiguration="RemoteEventsBinding"
      <endpoint name="TodayNetwork.PD1" address="net.tcp://" binding="netTcpBinding"
        bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication"/>
      <endpoint name="TripleMNetwork.PD1" address="net.tcp://" binding="netTcpBinding"
        bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication"/>
      <endpoint name="Dirt.PD1" address="net.tcp://" binding="netTcpBinding" bindingConfiguration="RemoteEventsBinding"
        <binding name="RemoteEventsBinding" portSharingEnabled="true">
          <security mode="None" />
        <behavior name="DebugServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="true" />
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />


#61235 Sep 12, 2012 14:16
  • Magnus Claesson
    Member since: 2007

    Did you ever solve this, I have the exact same problem as you! Portsharing enable, disable overlapping recycle, and the sites working fine but goes down when restart, very annoying!


    #61924 Oct 05, 2012 16:49

    We had our fair share of that problem, the solution for us was to do the automatic site mapping manually. Kind of backward, but it is what it is..

    This is an example of the config that should be in EPiServerFramework.config

      <add key="/LM/W3SVC/18100/ROOT:THEMACHINENAME" siteId="MySite" />
      <add key="/LM/W3SVC/18400/ROOT:THEMACHINENAME" siteId="MyOtherSite" />

    18100 and 18400 is the IIS site id, you also need to replace THEMACHINENAME with the name of the actual machine.

    Hope that works out.

    #62196 Oct 16, 2012 15:28

    Any permanent fixes to this? We see the same problem in production on our site.

    #66015 Feb 18, 2013 14:30

    Tore, I think EPiServer Support has a hotfix for it.


    #66021 Feb 18, 2013 16:32
  • Paul Middleton
    Member since: 2013


    Can anyone point me in the right direction regarding this issue please? Were currently experiencing this on our production environment. 


    #86365 May 20, 2014 12:54

    We fixed this by recycling the application pool right before we deploy. After might also work.

    Best case is if you turn the app pool off, deploy and then turn it back on.

    #86366 May 20, 2014 12:59
  • Roxana Plăian
    Member since: 2012


    We are seeing this issue after around 4h after the net.tcp configuration changes are deployed. Client is having 2 servers: 1 public web server for the webste and 1 admin server for doing CMS updates. Exception occurs on the public web server.

    I've already tried setting disable overlapped recycling to true, stopping the application pool and restating it after the deploy, recycling the application pool, and nothing seems to work. If we recycle the application pool for the web server, website is still down. If we recycle the application pool for both servers, public website becomes functional for ~ 30 min.

    Any idea?

    Thank you,


    #144964 Feb 23, 2016 12:22
  • Henrik Fransas
    Member since: 2007

    We also had this problem a lot when using TCP but not UDP so if it is possible to change to UDP it could be a solution.

    For us we did a IIS Reset after each deploy since the site was pretty much the only thing on that server and that solved it, but it was not a good solution.

    #144966 Feb 23, 2016 12:40
  • Roxana Plăian
    Member since: 2012

    Hi Henrik,

    Unfortunatelly, UDP is not an option since the web server is in a DMZ and the firewall prevents the CMS server updates to propagate to the web server via UDP. 

    I didn't try IIS Reset. I know we exprienced this issue before on another project and stopping and restarting the app pool on every deploy seemed to do the trick. However, here it doesn't seem to work.

    Appreciate your help.


    #144970 Edited, Feb 23, 2016 13:10
  • Henrik Fransas
    Member since: 2007

    The problem is that the IIS are a little "slow" to relase the existing connections and when you doing a IIS reset you force IIS to relase everyhing.

    Propably you can only restart the site and not the whole server. We also tried only application pool but didn't get it to work.

    I reported it as a bug to Epi but I think the response was that they are doing what can be done but I do not remember exactly.

    I was trying out to use a service bus (azure nuget package) to get rid of the tcp but at that time there were some problem with that implementation.

    I will try that out and write a blog post on it, since it should be the best solution I think

    #144971 Feb 23, 2016 13:15
  • Roxana Plăian
    Member since: 2012

    Thank you for the details. I will let you know as soon as I get to try the IIS reset.

    #144977 Feb 23, 2016 14:10
  • Björn Olsson
    Member since: 2005

    I'm having the same problems, I am not able to use UDP, so I have to use TCP. It worked when i stopped and restarted the app-pool, a recycle did not resolve the issue. This seems to be very shaky, which is far from optimal in a loaded balanced environment. Any updates from EPiServer yet?

    #147005 Apr 03, 2016 21:28
  • Saasen
    Member since: 2012

    We are also experiencing this issue, and TBH, we've had this issue several times. We've also tried contacting support, but no luck there as they say it's not an issue.

    I'm always having this issue when using TCP, even when disabling overlapped recycling, TCP Port Sharing ON and correct configuration.

    #160701 Oct 03, 2016 21:42
  • Andreas Ljung
    Member since: 2010

    We are currently experiencing this issue as well, would really appreciate some input about what we can try.

    Running an old CMS 6 R2 site

    #173930 Jan 13, 2017 8:27