What is using port 80? [duplicate]

Possible Duplicate:
How to find exe listening on port?

I have 2 web sites that are both configured to run on port 80 but both are stopped. If I start either one, I get the error

Cannot access the file because it is in use by another process

If I change the port of either web site to 81, they both will run, provided that I only start one of the two.

The question is, since I only see one running web site on port 80, how can I determine what is running on port 80?


Solution 1:

The command netstat -ano will list the PID (process ID) of the process that is listening on each TCP port. For example on my system PID 4 is listening on TCP port 80. Using Task Manager shows that process 4 is system.

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1016
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:1025           0.0.0.0:0              LISTENING       712 
  TCP    0.0.0.0:1026           0.0.0.0:0              LISTENING       1228
  TCP    0.0.0.0:1027           0.0.0.0:0              LISTENING       756

Solution 2:

You didn't give the version of Windows you're running, but if you're running Windows Server 2008 / Vista or later, Windows comes with a built-in tool (for Administrators only) called Resource Monitor.

I could swear this has been asked/discussed before on SU...

Here is a guide / walk through of the various features of Resource Monitor, one of which is under Network -> Listening Ports. You should be able to find the culprit there.

Resource Monitor is:

  • Easily accessible through Task Manager on Windows Vista / Server 2008 or later.
  • Graphically oriented and user-friendly.
  • Built into the operating system.
  • More generally useful than a program that only deals with network connections, since it tells you about memory, CPU, and disk also.

Solution 3:

The fastest and easiest way to find out is to run CurrPorts or TCPView and look for port 80 (or HTTP if resolving is on). You can also find out about other open ports.

They both give you an easy-to-use GUI to monitor and manage the network connections. For example, you can sort and filter them, and simply right-click and select Close to close a connection.

However, if you are getting an accessed denied error on the file, then I don’t think that the port being used is the problem (unless the program is simply using a generic error message and means access is denied on the port). In case the file is locked (not even with read-sharing), then use a program like Unlocker to find out what is locking the web-server’s executable file.