IIS crashes with unhandled exception in ASP.NET

Posted by SnowCrash on Server Fault See other posts from Server Fault or by SnowCrash
Published on 2012-04-11T04:44:13Z Indexed on 2012/04/11 5:31 UTC
Read the original article Hit count: 286

We had an issue recently with an unhandled exception in an ASP.NET C# application bringing down IIS and all application pools that it was hosting. IIS Manager was unable to restart or stop/start the service and I was unable start IIS again after killing w3wp.exe in the task manager. A system reboot restored IIS to a running state; as a primarily Linux admin, I generally consider an unplanned system reboot to resolve a software error to be an act of high heresy.

Is there a way to "harden" IIS so that a faulting application does not affect anything but the request that exposes the fault?

Some details on the server and application fault.

IIS: 7.5

.NET: 4.0

Windows Server 2008 R2

Faulted on call to System.Net.Dns.Resolve() with a url pointing to a non-existant domain as the argument. (I'm aware that this method is deprecated but the point that a page code issue shouldn't bring down the server still stands)

The exception generated was SocketException.

The faulting module according to event viewer was KERNELBASE.dll

The issue was resolved by wrapping the call in a try-catch, logging the exception and displaying some generic content on the page.

I'm hoping that I missed something in the IIS config that would switch it to "production" mode or something.

© Server Fault or respective owner

Related posts about windows-server-2008-r2

Related posts about ASP.NET