Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP could not register URL

I'm trying start a service that uses port 8081. The service stop immediately after start. I look into event viewer and i see this:

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

I tried to register url with netsh but it says that file already exists, but i can't delete the reservation and it not appear in reservation list (netsh http show urlacl).

netsh http add urlacl url=http:// +:8081/api/ user=\Everyone

Url reservation add failed, Error: 183 Cannot create a file when that file already exists.

netsh http delete urlacl url=https:// +:8081/api/

URL reservation delete failed, Error: 2 The system cannot find the file specified.

There's anything that i can do to solve this?

Note: The service runs well on another machines.

like image 299
hmiguel Avatar asked Oct 20 '14 13:10

hmiguel


3 Answers

There must be an existing entry covering the same url. You can verify this using the show command to discover what registrations exist, maybe pipe it to a file or grep it for the port number as you please, e.g.

netsh http show urlacl > d:\tmp\out.txt

Then you can delete the old entry (needs an exact url match - watch out for http vs https, and for trailing slashes - ideally copy paste from the output of the show command)

netsh http delete urlacl url=theExactRegisteredUrl

And add a new entry with the options you want

netsh http add urlacl url=theExactRegisteredUrl user=\Everyone
like image 151
Graham Avatar answered Oct 24 '22 21:10

Graham


Your delete command is using a https address as opposed to the http in the add command. Remove the 's' and it should work.

like image 35
Mark Avatar answered Oct 24 '22 21:10

Mark


Do not use the "+". Try this:

netsh http add urlacl url=http://0.0.0.0:8081/api/ user=\Everyone
like image 2
Brent Arias Avatar answered Oct 24 '22 21:10

Brent Arias