Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
West Wind WebSurge - Rest Client and Http Load Testing for Windows

IIS not starting: The process cannot access the file because it is being used by another process


:P
On this page:

Ok, apparently a few people knew about this issue, but it is new to me and has caused me nearly an hour to track down today. What happened is that I’ve been working all day doing some final pre-deployment testing of several tools on my local dev machine. In the process I’ve been starting and stopping several IIS 7 Web sites. At some point I was done and just wanted to start my Default Web Site again and found this  little gem of an error message popping up:

IISSkypeErrorDialog

The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

A lot of headless running around ensued after this, trying to figure out why IIS wouldn’t start. Oddly some sites started right up, others didn’t. I killed INetInfo, all worker processes, tried IISReset a million times and even rebooted – all to no avail. What gives?

Skype, you evil Bastard!

As it turns out the culprit is – drum roll please - Skype!  What, you may ask, does Skype have to do with IIS and Web Requests? It looks like recent versions of Skype have an option to run over Port 80 and 443 to allow running over corporate firewalls. Which is actually a nice feature that lets Skype work just about anywhere. What’s not so cool is that IIS fails to start up when another application is already using the same port that a Web site is mapped to. In the case of my dev site that’d be port 80 and Skype was hogging it.

To fix this issue you can stop Skype from using port 80 and 443 which quickly fixes the problem. Or stop Skype. Duh! To permanently fix the problem in Skype find the option on the Options | Connection tab and uncheck the Use port 80/443 option:

SkypeHttpOptions

Oddly I haven’t run into this problem even though my setup hasn’t changed in quite some time. It appears that it’s bad startup timing that causes this problem to occur. Whatever the circumstance was, Skype somehow ended up starting before IIS.  If Skype is started after IIS has started it will automatically opt for other ports and not use port 80 and so there’s no problem.

It’s easy to demonstrate this behavior if you’re looking for it:

  • Stop IIS
  • Stop Skype
  • Start Skype and make a test call
  • Start IIS

And voila your error is ready for you!

This really shouldn’t be a problem except that it would be really nice if IIS could give a more helpful error message when it can fire up a site because a port is blocked. “The process cannot access a file” is really not a very helpful error message in this scenario… I/O port / file ah what the heck it’s all the same to Windows. Right!

I’ve run into this situation quite a bit with other, albeit more obvious applications like running Apache on the local machine for testing and then trying to run an IIS application. Same situation,  although it’s been a while – pre IIS 7 and I think previous versions of IIS actually gave more useful error messages for port blockages and that would be helpful.

On the way to figuring this out I ran into some pretty humorous forum posts though with people ragging on why the hell you would be running IIS. Or Skype. The misinformed paranoia police out in full force so to say :-). It’ll be nice to start running IIS Express once Visual Studio 2010 SP1 gets released.

Anyway, no surprise that Skype didn’t jump out at me as the culprit right away and I was left fumbling for a while until the Internet came to the rescue. I’m not the first to have found this for sure – I posted a message on Twitter and dozens of people replied they’d run into this before as well. Seems worth mentioning again though – since I’m sure to forget that this happened in a year from now when I hit that same error. Maybe I’ll even find this blog post to remind me…

Posted in IIS7  Windows  

The Voices of Reason


 

Nick
March 06, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

You can do netstat -abn to get the list of listening ports / processes. A lot of them will just show "svchost" or no name at all but for user-level processes it works OK. The error message does suck but it would not be IIS if it came out with a clear error message!

Behnam
March 06, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

different issues can cause this problem, as you said one reason can be Skype, but obviously other things can this problem too.

there is Microsoft article about this issue too:

http://support.microsoft.com/kb/890015

rovsen
March 07, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

snarl ( http://tinyurl.com/622nezj ) can also cause this problem.

Rick Strahl
March 07, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

@rovsen - pretty much ANY software that shares port 80 (or any other port where an IIS site runs) and starts before IIS will cause this problem. Self-hosted WCF apps, self-hosted IIS etc. etc.

Using netscan -abn as suggested by Nick is probably the best way to check what's running and blocking your IIS port.

Doug Osborne
March 11, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

Rick,

I know I asked you one other time but I could not find it in search - what graphics editor do you use to get those images in your posts - they always look awesome.

Stay Dry,
Doug

Rick Strahl
March 11, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

@Doug - Images captured with SnagIt and posts written with Live Writer. Using my SnagIt capture plugin.

mario
April 07, 2011

# re: IIS not starting: The process cannot access the file because it is being used by another process

great, instruction solves the problem. THANK YOU!!

vipul sachan
June 03, 2014

# re: IIS not starting: The process cannot access the file because it is being used by another process

Above error is coming because default port 8080 is not assigned to system. So default website under IIS manager is not able start.
To Resolve the above error i followed the below steps, and it worked for me.

Step 1 - Go to run, type cmd, command prompt will appear.

Step 2 - We need to find which process is using the default port 8080. To find this type the below command in your command prompt. "Netstart -ano"

Step 3 - As per above screen the port 8080 is using by the process 3152. Now we need to find which application is assigned for process id 3152.
Type "tasklist /fi “PID eq 3152” in your command prompt and see the result.

Step 4 - Start your default website in IIS manager. It will work.

For more detail check the below link -
http://vsstack.blogspot.in/2013/09/iis-hresult-0x80070020-process-cannot.html

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024