Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Servicehost throwing an error, even though added to configuration with netsh

ServiceHost.Open() is throwing this error:

HTTP could not register URL http://+:8001/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

So I used netsh to add the url. But event though it is added, i'm still getting the error. This is the command I use:

netsh http add urlacl url=http://+:8001/ user=djerryy

djerryy is my computername. When I run netsh http show urlacl i see it was added.

What am I doing wrong?

Thanks in advance.

like image 849
Terry Avatar asked May 28 '10 09:05

Terry


2 Answers

It looks like you are missing the name of the user account who is running the service. Here's a couple of options:

  • Local user account:
netsh http add urlacl url=http://+:8001/ user=ComputerName\Username
  • Domain user account:
netsh http add urlacl url=http://+:8001/ user=DomainName\Username
  • Built-in NetworkService account:
netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORK SERVICE"
like image 53
Enrico Campidoglio Avatar answered Oct 17 '22 07:10

Enrico Campidoglio


I must stress:

netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORK SERVICE"

will work only on a system with the English locale!

A better way is to remove that one space and make it:

netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORKSERVICE"

Now the command will work on any locale. I spent a good 0,5h battling this today... all because of a single char. ;)

like image 45
Shaamaan Avatar answered Oct 17 '22 06:10

Shaamaan