c# - Running self-hosted OWIN Web API under non-admin account -
Is it possible for the self-hosted OWin Web API to run under a non-administrator account? I have already tried dozens of URL reservations and nothing works. The service fails to start with "Access Denied", it works when the account administrator is added to the role, but I do not want this. The code below is running on Win 7 Framework 4.5.2.
// install-package microsoft.owin.hosting // install-package Microsoft.Owin.Host.HttpListener Start Options Option = New initial option (); Options.Urls.Add ("http: // localhost: 5000 /"); //options.Urls.Add(string.Format("http://{0}.1000000 ", environment .mikinameam)); //options.Urls.Add("http://+ंबर000/ "); //options.Urls.Add("http://*:50000/ "); (WebApp.Start & lt; WebAPISelfHostMinimal.Startup & gt; (option)) using {while! (Terminate) {Waiting for the job. Della (10); // to keep the CPU partially) LogUtil.LogInfo ("Terminating the Oven Host."); }
Edit - It's running under a Windows account.
C: \ & gt; Netsh http add urlacl http: // +: 5000 / user = MINI 2012 \ svcAPI URL successfully added C: \ & gt; Sc start exception [SC] StartService failed 5: Access denied. C: \ & ntsh http add urlacl http: // *: 5000 / user = mini2012 \ svcAPI URL reservation added successfully C: \ & gt; Sc start exception [SC] StartService failed 5: Access denied: C: \ & ntsh http add urlacl http: // localhost: 5000 / user = mini2012 \ svcAPI URL reservation successfully added C: \ & gt; Sc start exception [SC] StartService failed 5: Access is denied.
It seems that the problem was with the URL reservation. I did not need one if there is a URL reservation, it will only prevent the Owin host from starting with an Access denied error. In addition, the default port for the Oven Host is 5000. If there is a "dead" process that is still running on that port, then it will stop you from starting your service. To check that you can run netstat -a -b
at the command prompt.
Comments
Post a Comment