WWSAPI samples in Windows 7 SDK for RC: "Unable to add URL to HTTP URL group."


I like to build and run with UAC on.  When running the HttpCalculatorService example I got this error: 


 Failure: errorCode=0x80070005
Unable to add URL to HTTP URL group.
Access is denied.

Running from an administrator command prompt I do not get the error!


Obviously I do not have permissions to something.  Some investigation revealed that I need to add the user I wanted to run as to the urlacl (http://msdn.microsoft.com/en-us/library/cc307223(vs.85).aspx)


So this is the command that allowd me to run (replace myDOMAIN\myUSERNAME with the domain and user you wish to run the Service under): netsh http add urlacl url=http://+:80/example user=myDOMAIN\myUSERNAME.


To do this in code you could use this API: http://msdn.microsoft.com/en-us/library/aa364503(VS.85).aspx but the code your are running would need to have the necessary permissions so you are in kind of a chicken and the egg situation!


Drop me a comment and let me know if this helped you please! 


 

Comments (2)

  1. Greetings from Germany.

    Your post just saved my day. I am new to WWSAPI and your post regarding the usage of netsh

    was the ONLY ressource on the web that points a developer to the approriate command. Thank you.

    While having your attention: There quite a few samples on msdn regarding WWSAPI. HOWEVER, all using

    localhost as the url. I got the service I developed up and running on localhost just fine. It failed utterly when

    runing it on our intranet.  There is no step-by-step tutorial on how to make a selfhosted WWSAPI-service availble on the network. After submiting netsh add urlacl … I now get HTTP-Statuscode "503 (0x1F7) Service Unavailable". What else needs to setup?? What else is missing?? The service is up and running, the url is registered …

    Thanks for your help.

  2. jpsanders says:

    I am glad this helped!  You will need to ensure that your firewall allows traffic in and out for that Port and Executable.  You can turn on firewall logging in order to see for sure if the firewall is the issue, but I am pretty sure your firewall is the problem.