netsh http add urlacl etc. - why is this needed?

Apr 30, 2010 at 6:17 AM

When I run statlight (1.0-beta1) as a non-admin user, I get the following output:

************* Error *************
Cannot run StatLight. The current account does not have the correct privilages.

Exception:
HTTP could not register URL http://+:8887/. Your process does not have access ri
ghts to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for det
ails).

Try: (the following two steps that should allow StatLight to start a web server
on the requested port)
     1. Run cmd.exe as Administrator.
     2. Enter the following command in the command prompt.
          netsh http add urlacl url=http://+:8887/ user=DOMAIN\user
*********************************

So far I haven't encountered this problem with other webservers that bind to non-privileged ports.

tcpview actually shows that process "System" is listening on 0.0.0.0:8887.

I am curious - why process "System"? And wouldn't it be sufficient in most cases to bind to 127.0.0.1?

A solution that would allow statlight to be run by any user without having to set any special permissions would be great.

 

Coordinator
Apr 30, 2010 at 2:29 PM
Edited Apr 30, 2010 at 3:49 PM

StatLight is currently leveraging the built in System.ServiceModel.Web.WebServiceHost.

You can see the usage in this file.
http://github.com/staxmanade/StatLight/blob/master/src/StatLight.Core/WebServer/StatLightServiceHost.cs

To tell you the truth, once I got this working, I figured most devs had some sort of admin rights and this wouldn't be too much of an issue (and at the time I had other problems to solve with StatLight).

However, I would love to take ideas on better solutions. If there is a way I can tell the WebServiceHost how to become a web server without requiring admin rights, that would be great, or any other lightweight options out there.

Hope this helps.

May 4, 2010 at 8:26 AM

I don't think you can prevent this if you use WebServiceHost.

I have found some useful background info here: http://blogs.msdn.com/paulwh/archive/2007/05/04/addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx#2418872

There are some C# webserver samples around (e.g. http://www.codeproject.com/KB/cs/single_threaded_nhttpd.aspx), but I don't know if they can be used for statlight.

Coordinator
Oct 10, 2010 at 9:32 PM

I know this is late... but I just pushed changes up to github that remove the need to run as administrator (from what I can tell)...

If you have an opportunity. Let me know if you can build and run/test it out... Hope this helps.

Coordinator
Nov 20, 2010 at 9:48 PM

Release v1.3 includes these changes.