28

IIS Express error: Failed to register URL for site. The process cannot access th...

 3 years ago
source link: https://gunnarpeipman.com/failed-to-register-url-for-site/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

IIS Express error: Failed to register URL for site. The process cannot access the file because it is being used by another process.

A little surprise during COVID-19 time coding. I cloned repo to my dev box, opened it in Visual Studio and hit F5. IIS Express starts and browser opens but it shows just error about site to be unreachable. After almost getting grey hair I found out what’s wrong. Here’s the solution.

It wasn’t any of the classic problems. Classic ones have one of these solutions:

  1. Open solution in Windows Explorer, close Visual Studio and delete .vs folder.
  2. Close IIS Express. Go to user folder in Windows Explorer and delete IIS Express subfolder.
  3. Open command prompt, type netstat -aof | findstr :<application port here>

If you have virtualization components enabled like it is in my dev box then make sure your application doesn’t try to use some reserved port.

Open command prompt and run the following command:

netsh interface ipv4 show excludedportrange protocol=tcp

On my dev box I got the following long list of port ranges:

Find exluded port ranges on Windows 10

Web application I tried to run was using port 56442 and it fell into one of port exclusion ranges.

Solution

Open properties page of your web application and make it use some available port that is not in port exclusion range.

Set port for ASP.NET application

After changing port click also on Create Virtual Directory button.

Now you are good to go. No need to restart IIS Express or Visual Studio. Just change port, let IIS Express create new virtual directory and run your application.

Liked this post? Empower your friends by sharing it!

A portal focused on Operations and Support for Microsoft Azure Serverless services

FREE TRIAL

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK