Everytime I try to debug my asp.net website I get this error:
Unable to launch the IIS Express Web server.
Failed to register URL "http://localhost:50010/" for site "SociopackWebAPI" application "/". Error description: The process cannot access the file because it is being used by another process. (0x80070020)
In eventviewer I noticed this error in the log:
The worker process for app pool 'Clr4IntegratedAppPool', PID='13248', failed to initialize the http.sys communication when asked to start processing http requests and therefore will be considered ill by W3SVC and terminated. The data field contains the error number.
I assume this means my Clr4IntegratedAppPool does not have enough rights? How can I fix thi?
One reason for the IIS Express being unable to start properly can be that the port it wants to use is reserved. The port you want to use will not show up in
netstat -an | findstr <your port number> if it is not in use.
You can either change the port you use or remove the reservation.
View reservations (elevated command prompt):
netsh int ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges Start Port End Port ---------- -------- 80 80 443 443 50000 50059 * * - Administered port exclusions.
You can remove the reserved range if it is not in use with
netsh int ipv4 delete excludedportrange protocol=tcp startport=50000 numberofports=60. Should reply
Ok. If you get
Access denied. it is because the range is currently in use. You will have to shut down the program that use the ports in order to create a reservation that intersects with the range.
If you want to create the range again, use
netsh int ipv4 add excludedportrange protocol=tcp startport=50000 numberofports=60.
I had this problem because I recently installed Hyper-V and Docker and my IIS Express threw error events in my event log with ID 2269:
The worker process for app pool 'Clr4IntegratedAppPool', PID='12345', failed to initialize the http.sys communication when asked to start processing http requests and therefore will be considered ill by W3SVC and terminated. The data field contains the error number.
And subsequently 2276:
The worker process failed to initialize correctly and therefore could not be started. The data is the error.
Source of my solution: Docker for Windows – Port Reservations | Developer Musings
I had exactly the same problem with VS2017 / IIS Express 10. Tried a few tips & tricks found at forums, but the only one that really fixed the bug definitively is the following:
If you cannot find your solution for this, try this:
"The process cannot access the file because it is being used by another process" usually means that there is something else already listening on that port. Maybe you started the same application twice?
Ensure the service
Application Host Helper Service (AppHostSvc) is running. Also ensure that
Host Network Service (hns) is running.
Some ASP.NET websites might also require
ASP.NET State Service (aspnet_state) to be running.
This worked for me:
I only did #2 because the privileges I had were correct already.
Open an elevated Command Prompt window. Click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator. Type:
net stop w3svc net stop http net start w3svc net start http
This happened for me when I opened an old solution with VS2019. None of the answers here worked for me. So I chose a different approach.
I created a new ASP.NET solution and saw which port is it using. it was using
Then I closed my solution and opened the .sln file and change the port.
After reloading the solution, it worked.
User contributions licensed under CC BY-SA 3.0