How to fix "Unable to launch IIS Express Web Server" "Failed to register URL"

  • Page Owner: Not Set
  • Last Reviewed: 2023-04-20

I got this message when trying to start a project with IIS Express.

enter image description here

Unable to launch the IIS Express We server.

Output from IIS Express:

Failed to register URL for site application "/" Error description: The process cannot access the file because it is being used by another process.


Answer

The solution to this is quite simple. First you can use the following command in the cmd line to check if your port is reserved by another process.

netsh interface ipv4 show excludedportrange protocol=tcp

If your port is reserved then you can edit the applicationhost.config file in the project to adjust the port.

Open the project in file explorer. Then (with view hidden files enabled) navigate into the .vs directory. From there you can find the following file

.vs/{Project_Name}/config/applicationhost.config

Find the port in the file that's causing issues and change it to an available port.

NOTE:

If you need to use HTTPS consider using a 443XX port


Additional Posts

I also found that occasionally something reserves a ton of ports for no reason. The hacky work-around is to start and stop the windows NAT service.

As admin:

net stop winnat

then

net start winnat