I was running a windows form application which had a reference to a WCF service. When trying to run the windows form application it worked fine but on a few systems it threw an error stating HTTP could not register URL
HTTP could not register URL http://+:80/Temporary_Listen_Addresses/6346-c612-4441-acf8-79ddd5c62f98/ because TCP port 80 is being used by another application.
The WCF service was publish subscribe service and had a wsDualHttpBinding. By default when we run the windows application client, it tried to register on the default port which is 80. But that port address may be busy. In my case, the system which threw an exception had skype application running on it. So, the solution was to specify the port address for the client to register the callback. I simply added a property ClientBaseAddress to the bindings in the web.config.
<wsDualHttpBinding> <binding name="WSDualHttpBinding_Notification" clientBaseAddress="http://192.168.2.131:10002/"> </binding> </wsDualHttpBinding>
So now I was providing a port address for the client callback. The address provided is the I.P of the system on which the windows form application is running.
But it all didn’t end here. Now when I tried running the windows application it showed another error.
HTTP could not register URL http://+:10002/. Your process does not have access
rights to this namespace.
In order to solve the above error, open the command prompt with administrative privileges. Run the following command.
netsh http add urlacl url=http://+:10002/yourURLifAny user=\Everyone
Once the above command has been executed it should be working fine 🙂
Wrapping It Up
In this quick post we saw how to solve the “HTTP could not register URL because TCP port 80 is used by another application” error. Hope you find it useful.
Have you ever encountered the above error ? How did you go about solving the it ? Do let us know your thoughts or suggestions in the comments below.