Today while at work, I get to troubleshoot one of the dot net windows service which refuse to start "running" in the services.msc console. End up one of us discovered the window service refuse to start because another service process is using the same port "8080". The below information will be useful to anyone installing windows service in future.
I goggle and again, found the way to track which process is using the same port as my windows service.
Windows Command
1. netstat -aon | findstr "<port number>"
This shows if the specified <port number> is being used. The number in the last column is the process id (PID) of the process holding the socket. Once PID is determined, one can refer to "Windows Task Manager" to determine which application corresponds to the PID.
Windows Example
C:\>netstat -aon | findstr "50000"
TCP 0.0.0.0:50000 0.0.0.0:0 LISTENING 2564
C:\>pslist 2564
pslist v1.28 - Sysinternals PsList
Copyright ¬ 2000-2004 Mark Russinovich
Sysinternals
Process information for MACHINENAME:
Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time
db2syscs 2564 8 15 366 30912 0:00:02.859 2:12:08.564
The example above shows the use of pslist to determine the name of the process. Note that pslist is a free command available from Microsoft Sysinternals at http://www.microsoft.com/technet/sysinternals/default.mspx .