Windows Service with Automatic (Delayed Start) fails to open a socket


I have a Windows Service which recently was set to Automatic(Delayed Start) from Automatic because sometimes it was failing to start and that would have required manual intervention to start it. But on one of the machines we are testing with the service failed to open a socket on TCP port 5000. The error is the following: Initialize(): System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP)

  • There is a rule on the firewall to allow the service to listen on TCP port 5000
  • Restarting the service results in the same socket error
  • netstat -o does not show any other process listening on TCP port 5000. Only on System start up I had one instance of the following: TCP [::1]:5000 PrecisionLab01:49844 TIME_WAIT 0

Returning the service to Automatic startup resolves the issue. No other system of our 4 test machines has that problem when the service is set for Automatic (Delayed Start)

Is there a way to diagnose which app is responsible for making the System kernel process to claim TCP port 5000?

Thank you in advance.

asked on Stack Overflow Nov 6, 2019 by rgeorg • edited Nov 13, 2019 by rgeorg

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0