I just transitioned some of my website's code from using QueueUserWorkItem
to Task.Factory.StartNew
I have some bad code that threw an Exception and it ultimately shut down w3wp. Running IIS 7.5 on Windows Server 2008 R2, x64
Task.Factory.StartNew(() =>
{
MethodThatThrowsException();
}
Application: w3wp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AggregateException Stack: at System.Threading.Tasks.TaskExceptionHolder.Finalize()
Exception: System.AggregateException
Message: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
StackTrace: at System.Threading.Tasks.TaskExceptionHolder.Finalize()
InnerException: System.Data.SqlClient.SqlException
I would have assumed an exception would have generated an event log and NOT have killed w3wp. Is this a wrong assumption?
Unhandled exceptions crash IIS worker process. This is by design. http://support.microsoft.com/kb/911816
Therefore, you should properly handle exceptions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With