none
Getting an AddressAdlreadyInUseException on one of my WCF services RRS feed

  • Question

  • We’ve got a server running in a VM hosted by our parent company. We’ve been having problems reaching it to do some maintenance that we need to do. The IT staff suggested that I reboot that server, which I did this morning about an hour ago. I tested accessing data from one of our applications, and it worked fine, so I thought we were good.

    However, about 30 minutes ago one of our users came to me and said he can’t run a different app. He was getting a message that reads as follows:

    I’ve gotten onto the server and checked what the event log shows there. Here’s a part of it:

    Log Name:      Application
    Source:        Service1
    Date:          4/25/2014 7:32:42 AM
    Event ID:      0
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      ISR153SQL01
    Description:
    Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:9001/ASIService/. Another application has already registered this URL with HTTP.SYS. ---> System.Net.HttpListenerException: Failed to listen on prefix 'http://+:9001/ASIService/' because it conflicts with an existing registration on the machine.
       at System.Net.HttpListener.AddAll()
       at System.Net.HttpListener.Start()
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       --- End of inner exception stack trace ---
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
       at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback
    selectTransportManagerCallback)
       at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel....
    Event Xml:

    This is related to a WCF service I wrote. It uses TCP for communication. It also uses .NET 4. This error is quite new to me, I’ve never seen it until 15 minutes ago. Doing a quick look on the Internet I found at article on Microsoft’s support website about this error when moving from .NET 4 to 4.5 – but this WCF service is still at .NET 4. (http://support.microsoft.com/kb/2773443)

    Here’s the endpoint as defined in the App.Config file for the relevant WCF service:

    <endpoint address="net.tcp://amci-int:9000/ASIService/" binding="netTcpBinding"
                    bindingConfiguration="tcp_ASIService" contract="SvrRef.IService1"
                    name="tcp_ASIService" />

    As you can see, I’ve specified an address using net.tcp; not HTTP, so I’m a little confused by why the error should say anything about HTTP. There’s nowhere else in the App.Config file that references HTTP for this WCF service.

    There was NO PROBLEM until I rebooted the server at IT’s request. Why has this come up now? And naturally, how do I fix it?

    The server is Windows Server 2008 R2 Standard with SP1

    Rod


    Rod

    Friday, April 25, 2014 2:42 PM

Answers

  • Hi Amy,

    My WCF service is hosted by a Windows Service, that I also wrote. I wrote the WCF service back in the Windows Server 2003 days, when IIS wouldn't host WCF services that use the TCP protocol. Now we're using Windows Server 2008 R2, which I believe can host WCF services in IIS that use TCP. I'd love to know how that is done, please.

    As to our problem, I believe we're resolved it, just this morning. The issue was a third party application we purchased, that was upgraded last week. Without knowing it, their upgrade now grabs a wide range of ports, including the one that my WCF service uses. Once our network people pointed out that the third party software had grabbed the port for itself, I called the vendor and talked to them, to learn how to free up the port my WCF service needs. I've done that and now it's working. I'll watch it for the rest of today, but I believe this issue is resolved. It wasn't a problem with the WCF service, nor the Windows Service, but something else grabbing the port for itself.


    Rod

    • Marked as answer by Rod at Work Monday, April 28, 2014 4:11 PM
    Monday, April 28, 2014 4:11 PM

All replies

  • OK, I made a mistake. There is a HTTP endpoint for that service. Here’s how it’s specified in the App.Config file:

    <endpoint address="http://amci-int:9001/ASIService" binding="basicHttpBinding"
    
                    bindingConfiguration="http_ASIService" contract="SvrRef.IService1"
    
                    name="http_ASIService" />
    

    But still, as you can see, the URL specified here doesn’t look anything at all like the one given in the error I reproduced in the original post.


    Rod

    Friday, April 25, 2014 3:40 PM
  • Hi,

    Is your service a self-host or IIS host application?

    If your application is a IIS host application, then please do not specify the whole address for the endpoint.

    It will be better if you can post all your wcf config file here, then it will help to find a solution.

    Then please try to enable the wcf tracing to find more error information.

    #How to enable wcf tracing:
    http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .

    Also you can use the fiddler to help you do the debug.

    #Fiddler:
    http://www.telerik.com/fiddler .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 28, 2014 4:46 AM
    Moderator
  • Hi Amy,

    My WCF service is hosted by a Windows Service, that I also wrote. I wrote the WCF service back in the Windows Server 2003 days, when IIS wouldn't host WCF services that use the TCP protocol. Now we're using Windows Server 2008 R2, which I believe can host WCF services in IIS that use TCP. I'd love to know how that is done, please.

    As to our problem, I believe we're resolved it, just this morning. The issue was a third party application we purchased, that was upgraded last week. Without knowing it, their upgrade now grabs a wide range of ports, including the one that my WCF service uses. Once our network people pointed out that the third party software had grabbed the port for itself, I called the vendor and talked to them, to learn how to free up the port my WCF service needs. I've done that and now it's working. I'll watch it for the rest of today, but I believe this issue is resolved. It wasn't a problem with the WCF service, nor the Windows Service, but something else grabbing the port for itself.


    Rod

    • Marked as answer by Rod at Work Monday, April 28, 2014 4:11 PM
    Monday, April 28, 2014 4:11 PM