After re-installing Windows on my laptop a little while ago, I got an error when setting up Internet Information Services (IIS) which I hadn’t seen before. When I tried to start the “Default Web Site”, IIS claimed that it couldn’t start it providing the following explanation; “The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020).”
Microsoft explains that the error code 0x80070020 translates to ERROR_SHARING_VIOLATION, and that the issue may related to another service on the computer grabbing TCP port 80 and/or 443.
From the command prompt I issued the following command, “netstat –o –n –a | findstr 0.0:80”, which gave me the ID of the process that was currently listening on port 80. Using the process ID (PID) it was easy to find the program in question using the “Task Manager”. And in my case the problem was Skype (might be another program in your case).
It turns out that Skype by default tries to use port 80 and 443 as alternatives for listening to incoming connections. And since I installed (and started) Skype before I set up IIS (and tried starting my website), Skype grabbed my port 80. Shutting down Skype (or just killing the Skype process from the Task Manager) allowed me to start my website since port 80 then became available again.
You can prevent Skype from grabbing port 80 and 443 by going into Skype’s “Tools –> Options –> Advanced –> Connection” and unchecking “Use port 80 and 443 as alternatives for incoming connections”.