开发者

Task.Factory.StartNew with uncaught Exceptions kills w3wp?

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 a开发者_如何学Cnd 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜