Unable to launch the IIS Express Web server...
Nowadays, I don’t quite often use IIS express web server for web development since I move to .NET core and Kestrel becomes my favourite local development server. However, when I need to support legacy customers solution, I prefer choose IIS express first before moving to IIS server. I barely have issue with IIS express except this annoying one randomly happened and it always takes me decent amount of time to get everything working again.
In this blog post, I decide to document one of the root cause for this issue I encountered and the fix, so I don’t have to spend more than a few minutes whenever I encounter this issue again.
Symptom
1
2
3
4
5
6
7
8
9
10
11
12
---------------------------
Microsoft Visual Studio
---------------------------
Unable to launch the IIS Express Web server.
Failed to register URL "http://localhost:xxxx/" for site "xxxxxx" application
"/". Error description: The process cannot access the file because it is being
used by another process. (0x80070020)
---------------------------
OK
---------------------------
Causes
According to my research, it looks like many ports are restricted/reserved to access on Windows machines on some Windows updates or applications
You can use the following command to list the reserved ranges.
1
netsh interface ipv4 show excludedportrange protocol=tcp
If you find the port configured in Visual Studio listed in above command, it means the port is not available for use by IIS express.
Fixes
The fix would be much easier once the root cause has been identified.
There are two solutions and both of them works fine me.
Solution 1
Change to different port that are not in the reserved ranges
Solution 2
Run the following command
- Stop
winnat
1
net stop winnat
- Start your web application
- Start
winnat
1
net start winnat
I hope you find this blog post helpul and get your development environment back to normal quicker.
References
- “Unable to launch the IIS Express Web server.” in Visual Studio
- Visual studio 2019 “Unable to connect to web server ‘IIS Express’”
- Unable to start Kestrel getting ‘An attempt was made to access a socket in a way forbidden by its access permissions’
- Many excludedportranges how to delete - hyper-v is disabled
Happy Coding! 😇
Comments powered by Disqus.