How to Force Kill IIS Express When It Won’t Release Port 80


2 views

Many developers encounter this frustrating scenario - you've closed Visual Studio or stopped debugging, but IIS Express continues running in the background, stubbornly holding onto port 80. Even after uninstalling Visual Studio components, you might still see IIS Express serving 404 pages.

Traditional approaches like these often don't work with IIS Express:

iisreset /stop
iisreset /kill
net stop w3svc

This is because IIS Express operates differently from full IIS - it runs as a user-level process rather than a system service.

Here are reliable ways to completely stop IIS Express:

Method 1: Task Manager Force Kill

1. Open Task Manager (Ctrl+Shift+Esc)
2. Locate these processes:
- iisexpress.exe
- iisexpresstray.exe
3. End all instances

Method 2: Command Line Termination

Run these commands in an elevated Command Prompt:

taskkill /F /IM iisexpress.exe
taskkill /F /IM iisexpresstray.exe

Method 3: Delete ApplicationHost.config

Sometimes the configuration gets corrupted. Navigate to:

%USERPROFILE%\Documents\IISExpress\config\applicationhost.config

Delete or rename this file, which will force IIS Express to generate a fresh configuration.

To stop IIS Express from automatically grabbing port 80:

netsh http delete urlacl url=http://*:80/
netsh http add urlacl url=http://*:80/ user=Everyone

This removes then recreates the URL reservation with proper permissions.

For a nuclear approach to completely remove IIS Express:

%PROGRAMFILES%\IIS Express\iisexpress.exe /uninstall
%PROGRAMFILES(x86)%\IIS Express\iisexpress.exe /uninstall

Many developers encounter situations where IIS Express continues running in the background even after closing Visual Studio or attempting standard shutdown methods. The process stubbornly holds onto port 80, returning 404 errors despite all apparent termination attempts.

Traditional approaches like these often prove ineffective:

iisreset /stop
iisreset /kill
net stop w3svc

This happens because IIS Express operates differently from full IIS - it's essentially a user-mode development web server that doesn't run as a Windows Service.

Method 1: Task Manager Kill

The most straightforward approach:

  1. Open Task Manager (Ctrl+Shift+Esc)
  2. Locate all instances of "iisexpress.exe"
  3. End each process tree

Method 2: Command Line Termination

For automated solutions or remote scenarios:

taskkill /f /im iisexpress.exe
taskkill /f /fi "status eq running" /im iisexpress.exe

Method 3: PowerShell Approach

More powerful process termination:

Get-Process iisexpress | Stop-Process -Force

After terminating the process, clear any residual port bindings:

netsh http delete urlacl url=http://*:80/
netsh int ip reset

To avoid recurrence, consider these measures:

1. Disable IIS Express auto-start:
   - Open Visual Studio
   - Tools → Options → Projects and Solutions → Web Projects
   - Uncheck "Stop IIS Express on closing Visual Studio"

2. Modify applicationhost.config:
   <site name="YourSite" id="1">
     <application path="/" applicationPool="Clr4IntegratedAppPool">
       <virtualDirectory path="/" physicalPath="YourPath" />
     </application>
     <bindings>
       <binding protocol="http" bindingInformation="*:8080:localhost" />
     </bindings>
   </site>

If all else fails, completely uninstall IIS Express:

1. Control Panel → Programs → Uninstall a program
2. Remove "IIS Express" and "Microsoft Web Deploy"
3. Manually delete remaining files:
   - C:\Program Files (x86)\IIS Express
   - C:\Users\[user]\Documents\IISExpress
4. Clean registry entries (backup first):
   - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IISExpress