views:

87

answers:

1

Hey guys,

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. (see pic)

What am i doing wrong?

Thanks in advance.

alt text

+1  A: 

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"
Enrico Campidoglio
i'm not in a domain.and i tried DJERRYY\Djerry, which still gave me the same error
djerry
Where are you hosting your service? Do you start it from Visual Studio? What is the service endpoint?
Enrico Campidoglio
No, the service was installed with a setup project. It runs form windows services. This is the address i'm using as Uri : "net.tcp://localhost:8000", but i also tries adding 8000...
djerry
That URL does not use HTTP as transport protocol. It uses TCP, so you shouldn't get that error. Shouldn't it be "http://localhost:8001" instead? Also, under which user account is the Windows Service running?
Enrico Campidoglio
you've lost me now: this (net.tcp://localhost:8000) isn't used in commands if i understand you correctly, it is the setup of my server (this link shows my setup : http://stackoverflow.com/questions/2847097/how-to-restart-a-wcf-server-from-within-a-client)the service is running as a network service, and i'm logged in as "djerry", which should be administrator.
djerry
You need to grant access to the HTTP URL to the NetworkService account. I updated my answer with the correct command.
Enrico Campidoglio
at last, servicehost opened. Now to get my client connected again... :)
djerry