FIXED: IIS Express The Process Cannot Access the File Because it is Being Used by Another Process. (Exception from HRESULT: 0x80070020)

2/4/2015 5:39:22 PM

I do my primary development with Visual Studio 2013 on a Windows 8.1 machine. I have recently seen the following IIS Express error more frequently.

If you Google this error you will most likely get instructions for using netstat to check all ports that are in use. This is necessary bit for some reason, I wasn't getting my answer. People will possibly point to Skype using port 80 as the culprit. This might be the case for you but it wasn't for me. What ended up being the culprit for me was Google Chrome.

I was developing a website that was using the IIS Express port 49215. It is important that this project always uses this port because I use Facebook Connect to login and my test FB App uses localhost:49215 to ensure requests are valid. When I first start my computer, load Visual Studio, and Run the project, everything is fine. I can code, test, stop, code, test, stop...etc. But every now and then, the test part cannot continue because I receive the IIS Express "The Process Cannot Access the File Because it is Being Used by Another Process. (Exception from HRESULT: 0x80070020)" error. Without a resolution, I would often restart my computer to get back to a "clean" state. I finally figured out what the issue was. Google Chrome.

So to fix the issue I did the following:

  1. From a command prompt run netstat.

    	
    >netstat -ano | find "49215"
    

    This will find any connections using the port 49215. To view all ports, you can remove the "| find "49215"" section.

  2. If netstat finds the port, you should see a PID (Process Id) in the last column. You can then open up Task Manager to find the related Process Id. If you do not see the PID column under the "Processes" tab, right-click the columns headers and add the PID column. You should now be able to find and terminate the process that is using your port.

In my case, it was Google Chrome. Closing Chrome solved my issue. Now I do not know if Google Chrome is the offender or if there is a Google Extension that is the offender. Either way, restarting Chrome fixed the issue for me.

If I can determine the precise offender (a Google Extension), I will let you know. Until then I am happy to have a much easier workaround to an extremely frustrating issue.

Edit:

And when the above stopped working for me, I ran the following command in an elevated command prompt (right-click and Run as Administrator).

	
>netsh http add iplisten ipaddress=127.0.0.1