Recently I was developing web service with several Web APIs. After few check-ins I decided to step through the code.
The service wouldn’t start. What? “It worked on my machine” just few hour ago. What’s wrong?
The exception was coming out of System.Net.HttpListener (I write in C#) and the message was following: System.Net.HttpListenerException (0x80004005): The process cannot access the file because it is being used by another process.
Maybe there is a bastard process from the previous run? I checked Process Explorer – nothing. I also have ISS up and running – which I decided to stop:
I couldn’t do that either, it would throw a an error. “That’s getting more interesting”, I thought. Well, most likely something is using ports that my web service is listening on. Which port would it be? I had only 80 and 8080 ports opened on my web service. But what is it?
C:>netstat -ano | findstr :80 | findstr LISTENING TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 6112
OK, so the PID of the server is 6112, let’s take a look what it is. Skype! Wow, that’s interesting – it was running in the background and I never had issues with it, but for whatever reason it started to listen on that port. I killed skype process and moved on to debugging my code.