How to choose which port to use when building a windows service? (windows & .net) [closed] How to choose which port to use when building a windows service? (windows & .net) [closed] windows windows

How to choose which port to use when building a windows service? (windows & .net) [closed]


The official assignments registred with the Internet Assigned Numbers Authority (IANA) for HTTP are:

  • 80: standard port for HTTP,
  • 8080: HTTP alternate (commonly used by cache or proxy or web server running as a non-root user)

The ports below are non official ports (not registered with IANA) that are also used:

  • 8081: HTTP alternate
  • 8090: HTTP alternate (used as an alternative to port 8080)

I don't know what kind of machines you are targeting but if they include development machines, I would probably use 8090 to minimize possible conflicts.

References


Ultimately we chose an arbitrary unused port in the Registered Port range - from 1024 through 49151 - and then made it configurable on the offchance someone comes along and uses that port for something else. Best solution would then be to register that port.

We chose not to use a dynamic port as processes are able to arbitrarily start using them, so it'd be less consistent whether the port was available.


If your service is HTTP then you should use port 80 - the standard HTTP port. This is typical of most REST webservices.