I bet you may have seen this error at least once If you are a web developer 🙂
Different error from different tools
IIS manager gives
--------------------------- Internet Information Services (IIS) Manager --------------------------- This Web site cannot be started. Another Web site may be using the same port.
Apache port:443 is being used by another application.
Port 10360 is already being used by another application
So how can we fix this error.There are two parts for this error.
- To find out which program uses this port
- Does this program really needs to use this port or some other ?
GUI tool approach: Find the processs using port TCPView tool.
You can use tcpview tool from sys internals. This shows all the connections active in the system with which process is using it .
You can also easily close the connection forcefully and make the port free just by right clicking on a particular connection.
In the above example, am going to close the connection opened by postgres on port 5432.This can be the port you are looking at where you got the error.
command line approach: Finding out which program uses this port using netstat command.
We combine the output of netstat with find command. We are filtering the netstat output with find .
C:\>netstat -ano |find ":80" TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4 TCP 22.214.171.124:51311 126.96.36.199:8080 ESTABLISHED 7584 TCP 188.8.131.52:51351 184.108.40.206:8080 ESTABLISHED 7584 TCP 220.127.116.11:51383 18.104.22.168:8080 ESTABLISHED 7584 TCP 22.214.171.124:51462 126.96.36.199:8080 ESTABLISHED 7584 TCP 188.8.131.52:58672 184.108.40.206:8080 ESTABLISHED 7584 TCP [::]:80 [::]:0 LISTENING 4 TCP [::]:8080 [::]:0 LISTENING 4
Interpreting the output,you can see the processid in the last column .In our case we have 4 and 7584.That is the process which is using the port.
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
- TCP is the protocol we are listening on.
- IP:Port combination 0.0.0.0:80 or [::] means all IP address in this machine we are LISTENING .More details here
- So process id with 4 is listening on 80 and 8080 and you are seeing 4
0.0.0.0:80 , 0.0.0.0:8080 , [::]:80 ,[::]:8080
process with 4 is basically system process.
Now to find out the process ,we can run another command tasklist
C:\>tasklist |find "7584"
chrome.exe 7584 Console 1 144,272 K
process 4 represents System process.
C:\>tasklist|find " 4 "
System 4 Services 0 308 K
Now you know the process,you can go and verify it really needs to use this port or not
- You can close the connection using TCP view
- you can stop or kill this particular process. E.g. You have both IIS and Apache installed in one machine and may be some apache website is already using a port you need it.
- You can reconfigure one process to use another port(e.g. get apache to run under port 8080) or if it is Visual studio,you can go to VS and configure project configuration settings to use another port