Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running ServiceStack self-hosted application without administrative privileges

I'm trying to host my ServiceStack service in a console host. I need the ability to launch my service without administrative privileges. But when I try to do this, I get an exception "Access is denied. An unhandled exception of type 'System.Net.HttpListenerException' occurred in ServiceStack.dll".

  • There's seems to be a solution for Web API but I haven’t found such for ServiceStack.
  • I tried to do this using restrict attributes with no success.
  • I also tried solution from here, but this command requires user to have administrative privileges.

Is there any way to launch my ServiceStack self-hosted app without administrative privileges?

like image 720
Anton Anikeev Avatar asked Aug 11 '14 14:08

Anton Anikeev


1 Answers

To get ServiceStack running without administrative privileges you need to ensure that:

  • The host protocol is http
  • The hostname you use can only be localhost
  • You use a port number higher than 1024

So for example these hosts can be created without administrative privileges:

  • http://localhost:8000
  • http://localhost:8080
  • http://localhost:1050 ... etc.

Hostnames using wildcards, domains other than localhost, ports lower than 1024 or https require admin rights, unless a rule has been granted using netsh on Windows, or httpcfg on mono platforms.

  • http://localhost:80
  • http://+:8080
  • http://*:8080
  • http://domain.com:8080
  • http://domain.com:80
  • https://localhost:8080
like image 88
Scott Avatar answered Nov 10 '22 20:11

Scott