locked
ServiceModel.AddressAlreadyInUseException stopping wcf service from starting

    Question

  • I have a windows service that hosts two WCF services - one using HTTP on port 8731 and the other using HTTPS on port 8732.

    When I start the service, it stops after about 30 seconds with the following error

    Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL https://+:8732/Design_Time_Addresses/WcfServiceHost/Session/. Another application has already registered this URL with HTTP.SYS. ---> System.Net.HttpListenerException: Failed to listen on prefix 'https://+:8732/Design_Time_Addresses/WcfServiceHost/Session/' because it conflicts with an existing registration on the machine.

    using "netstat -a" before and after trying to start the service indicates that there is nothing listening on port 8732.

    If I change the port from 8732 to 8733 in app.config, the service starts successfully. Running netstat -a indicates that nothing is listening on port 8732.

    If I change the port back to 8732, it stops working again. I would really like to understand why this happening, but am not sure where to go from here. Any help would be appreciated.

    Simon

    • Edited by SimonLondon Sunday, April 11, 2010 9:33 AM spelling mistake corrected
    Sunday, April 11, 2010 9:32 AM

Answers

  • I ended up changing the ports used by the application to start at 9000. port 8732 is used by visual studio and so cannot be used by the application as well. 

    Simon

    • Proposed as answer by sdjc1 Friday, February 17, 2012 1:18 AM
    • Marked as answer by SimonLondon Friday, February 17, 2012 9:42 AM
    Wednesday, May 18, 2011 7:05 AM

All replies

  • In case anyone else comes across this problem, I've found a solution that works on Windows 7

    When I ran the following command

    netsh http show urlacl

    the following was shown

       Reserved URL            : http://+:8732/Design_Time_Addresses/
           User: NT AUTHORITY\INTERACTIVE
               Listen: Yes
               Delegate: No
               SDDL: D:(A;;GX;;;IU)

    So I deleted it by running

    netsh http delete urlacl http://+:8732/Design_Time_Addresses/

    and the services now starts properly.

     

     

     

    Monday, April 12, 2010 4:33 AM
  • In case anyone else comes across this problem, I've found a solution that works on Windows 7

    When I ran the following command

    netsh http show urlacl

    the following was shown

       Reserved URL            : http://+:8732/Design_Time_Addresses/
           User: NT AUTHORITY\INTERACTIVE
               Listen: Yes
               Delegate: No
               SDDL: D:(A;;GX;;;IU)

    So I deleted it by running

    netsh http delete urlacl http://+:8732/Design_Time_Addresses/

    and the services now starts properly.

     

     

     

    • Marked as answer by SimonLondon Monday, April 12, 2010 4:34 AM
    • Unmarked as answer by SimonLondon Friday, February 17, 2012 9:42 AM
    Monday, April 12, 2010 4:34 AM
  • So I deleted it by running

    netsh http delete urlacl http://+:8732/Design_Time_Addresses/

    and the services now starts properly.

     

    Don't do this!

     

    This url reservation entry is made to enable you debugging wcf services when you launch vs2010 without the elevated mode.

     

    If you already deleted this urlacl; you can restore it with this command

     

     

    netsh http add urlacl url=http://+:8732/Design_Time_Addresses/ user=INTERACTIVE delegate=no listen=yes

     

     

    Monday, September 27, 2010 8:36 AM
  • Any Solution you found for this because I am facing same issue?
    Mohit Jethva
    Wednesday, May 18, 2011 6:41 AM
  • I ended up changing the ports used by the application to start at 9000. port 8732 is used by visual studio and so cannot be used by the application as well. 

    Simon

    • Proposed as answer by sdjc1 Friday, February 17, 2012 1:18 AM
    • Marked as answer by SimonLondon Friday, February 17, 2012 9:42 AM
    Wednesday, May 18, 2011 7:05 AM
  • Thanks ! That was very helpful!!
    Friday, February 17, 2012 1:18 AM