Skip to content
statance
MenuClose
← All troubleshooting guides

Find what is using a port on Windows

Windows

In PowerShell, run Get-NetTCPConnection -LocalPort PORT -State Listen and pass the OwningProcess to Get-Process. In Command Prompt, netstat -ano | findstr :PORT shows the PID in the last column. PID 4 (System) means a kernel driver such as HTTP.sys owns the port — check netsh http show urlacl and servicestate.

Symptoms

  • An application fails with “address already in use” or error 10048
  • IIS or a web server cannot bind to port 80 or 443
  • You need to know what is listening on the server

How to diagnose it

  1. Find the listener with PowerShell

    Shows the process name for the PID.

    Get-NetTCPConnection -LocalPort 8080 -State Listen | ForEach-Object { Get-Process -Id $_.OwningProcess }
  2. Use netstat

    The last column is the PID.

    netstat -ano | findstr :8080 tasklist /FI "PID eq 1234"
  3. UDP ports

    UDP endpoints have no Listen state.

    Get-NetUDPEndpoint -LocalPort 53 | ForEach-Object { Get-Process -Id $_.OwningProcess }
  4. If the PID is 4 (System)

    HTTP.sys is serving the port for IIS, WinRM, or another registered URL.

    netsh http show servicestate

Common causes and fixes

Another web server or IIS site bound to the port

Stop the other site or service, or change its binding.

HTTP.sys reservation (PID 4)

Find the registered URL in servicestate and stop the service that owns it (W3SVC, WinRM, SSRS and others).

A previous instance of your application still running

Stop it.

Stop-Process -Id PID

Prevent it happening again

  • Add a TCP port check for services that must be reachable.

Set it up: Windows Server monitoring · TCP port monitoring.

FAQ

What is the Windows equivalent of lsof -i?

Get-NetTCPConnection in PowerShell, or netstat -ano in Command Prompt.

Why is port 80 used by System (PID 4)?

HTTP.sys, the kernel HTTP listener, owns it on behalf of IIS or another service registered with it.

Related guides

Get alerted before this becomes an outage.

Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.