Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

if I try to run my program that uses HttpListener without root it throws this exception.

Unhandled Exception: System.Net.Sockets.SocketException: Access denied
  at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x00000] in :0
  at System.Net.EndPointListener..ctor (System.Net.IPAddress addr, Int32 port, Boolean secure) [0x00000] in :0
  at System.Net.EndPointManager.GetEPListener (System.Net.IPAddress addr, Int32 port, System.Net.HttpListener listener, Boolean secure) [0x00000] in :0
  at System.Net.EndPointManager.AddPrefixInternal (System.String p, System.Net.HttpListener listener) [0x00000] in :0
  at System.Net.EndPointManager.AddListener (System.Net.HttpListener listener) [0x00000] in :0

How can I allow HttpListener to be used by users besides root?

share|improve this question
add comment

1 Answer 1

If you want it to listen on port 80, it'll need to be started by the root user. If you're okay with it listening on a port > 1024, then any user should be able to start it.

If you want other users to be able to start this listening on port 80, then you'll need to allow them to run it via sudo.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.