我正在做代码审查,发现了这段代码。在线程内抛出异常会导致 IIS 崩溃吗?阅读评论。
Thread unhandledExceptionThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
{
System.Threading.Thread.Sleep(90 * 1000);
throw new ApplicationException("Thread 1");
}));
unhandledExceptionThread.Name = "IntentionalCrasher";
Thread environmentExitThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
{
System.Threading.Thread.Sleep(100 * 1000);
Environment.Exit(-500);
}));
environmentExitThread.Name = "Thread 2";
unhandledExceptionThread.Start();
environmentExitThread.Start();