Home > WCF > Err: Another application has already registered this URL with HTTP.SYS

Err: Another application has already registered this URL with HTTP.SYS

While running a WCF solution (including a service project and a service host) the following error can occur:

“HTTP could not register URL http://+:8080/MyServiceName/. Another application has already registered this URL with HTTP.SYS.”

I faced this problem when I tried to run some of the practice exercises for MCTS 70-503 Training Kit.

Cause: When you set the solution starting program to the service host, visual studio still runs the WCF SVC Hostt before your service host project and it put a listener on the port before your host application does. This only happen when you run the solution in the debug mode. In the Start Withouth Debuging (Ctrl +F5)  mode this does not happen.

Solution: I thought that WCF SVC Host could be disabled from the Service project>Properties>Debug Tab>Command Line Argument. It is a natural place to look for this and in fact I thought you should be able to remove the predefine value in the box “/client:”WcfTestClient.exe” and stop WCF SVC Host to run. However, it does not work. For more information you can read the following post on MSDN forum:Disabling WcfSvcHost when self-hosting. So I found the only way around this problem, is renaming the App.config file for the Service project to something like “App.config.temp”. This certainly stop executing WCF Test Client.

Advertisements
Categories: WCF Tags: ,
  1. Sergey
    June 8, 2009 at 4:35 am

    Hello Amir,

    I encountered the same problem.
    Seems like the sService library project gets hosted during Debug startup together with the main host application.
    If to change baseAddress attribute value in the app.config file of the service libabry project to contain some other port number than one used for that property in the host project then one could start debugging in the VS.

  2. June 8, 2009 at 11:33 am

    Yes, this sounds doable and a better solution. Thanks for your comment.

  3. August 10, 2009 at 11:13 pm

    I also faced this issue and got it resolved. Kudos to both Amir and sergey :)

  4. robert
    September 17, 2009 at 11:26 am

    Thanks for the baseAddress solution. I am still having problems with Chapter 1 running the first lab. How can you leave the ServiceConsoleHost running (in debug mode I assume), and then change the startup project and run the client? It’s not possible, so what am I missing? The documentation says:
    “you can leave the service host application running, switch the startup project to the TaskClient Windows Forms application, and run it against your service”

  5. Brad Fulton
    November 6, 2009 at 10:33 am

    Thanks for explaining what’s happening. However, I think that you can just uncheck “Start WCF Service when debugging another project in the same solution” under WCF Options in the Properties for the Task.Services project.

  6. bvvtech
    June 8, 2010 at 11:25 am

    Hi
    I encountered the same issue, and found that there was a app.config file in Tasks.Services proj. Just simply remove this app.config file and it would solve this issue.

  7. Rico
    June 28, 2010 at 8:36 pm

    Hi Robert,

    When you build the project, an executable is generated in your bin folder for the ServiceConsoleHost. Navigate through the folder and run it as administrator. Next, open visual studio and set your client solution as the start up project. Start debugging and your client should be able to connect to the host. Alternatively you could open two instances of Visual Studio and start debugging the host first and the client second (in the other instance).

  8. Swats
    September 8, 2010 at 7:53 pm

    Hi All apologies for posting a question in this blog but this is teh first time i am writing a question on a site and this site helped me a lot solving my issues. please bear with me.
    I am preparing myself for 70-503 exam.
    while doing an exercise for creating proxy using Visual studio, the proxy is created fine but whenevr a fault is raised it breaks, after exploring i found out that the service created doesnt have reference to system.service model thats why when i m throwing a new exception of type faultexception its not recognising.

    please help…….

  9. September 8, 2010 at 8:48 pm

    I am not quite sure what Swat’s question is. If you miss a reference to ServiceModel then I do not expect that the whole solution will be compiled without raising any error.

  10. trendl
    November 17, 2010 at 6:24 pm

    You can get around this problem by unclicking ‘Start WCF Service Host when debugging another project in the same solution’ in the properties of your WCF service project. At least that worked for me.

  11. jfc
    December 20, 2010 at 10:22 am

    Thanks Brad! You’re solution works magnificently and is much nicer the modifying configs to get this to work.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: