Sunday, June 20, 2010

A convenient way to deal with "Unexpected Error 0x8ffe2740"

A convenient way to deal with "Unexpected Error 0x8ffe2740"

Ever had the annoying problem of IIS not wanting to start, coughing up the message "Unexpected Error 0x8ffe2740 Occurred."? The reason is that some other application has grabbed port 80. The most common applications doing this are Skype or Trillion. You can try just ending task on them and see if IIS will then start. If you're not running either of those then what could it be? Microsoft's KB article about the subject describes using the third-party utilities TCPView or FPort. But I think an easier way to find the issue is to simply drop out to a command prompt and run:

netstat -aon

Scroll up to the top part with TCP listings and you'll see something like this:

Then under "Local Address" look for 0.0.0.0:80. This is your entry, and a the far right is the PID you're after. With that number you can then run Task Manager, select the Process tab, and add the PID column in the display from View / Select Columns:

When you've found the process with the same PID, end task on it. The universe should then return to a state of perfect harmony. (Or at least your IIS will be able to start at that point!)

Alternatively, you can kill a process from command prompt:
taskkill /F /PID 300 (/F is for forcefully closing, 300 is PID)
or, taskkill /F /IM processName (processName is the name of the process like skype.exe, notepad.exe etc.)

Another more geeky option to kill the offending app is to compile and run this line of .NET code:

System.Diagnostics.Process.GetProcessById( PID# ).Kill()

(Of course putting in the proper PID where indicated there.)

With everything that the Process class does, you could actually write your own highly effective Task Manager application in .NET if you really wanted to!

No comments: