我目前在生产服务器上面临一个该死的奇怪问题。偶尔默认的应用程序池在iis上崩溃。经过几个小时的调查,最终将问题分离出来,并创建了几行可靠地重现问题的代码:
public class DemoHttpHandler: IHttpHandler {
public void ProcessRequest (HttpContext Context) {
try {
Context.Response.End();
}
catch(ThreadAbortException) {
}
finally {
}
}
}
此序列导致以下错误:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT/scs-testint
Process ID: 4752
Exception: System.Threading.ThreadAbortException
Message: Thread was being aborted.
StackTrace: at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
导致此错误:
Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17415, time stamp: 0x54505737
Exception code: 0xe0434352
Fault offset: 0x0000000000008b9c
Faulting process id: 0x1290
Faulting application start time: 0x01d125da7b0fc43e
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: b9b1e16f-91cd-11e5-80db-00155d3c110b
Faulting package full name:
Faulting package-relative application ID:
如果我删除EMPTY ???最后阻止,一切正常,IIS不再崩溃......
public class DemoHttpHandler: IHttpHandler {
public void ProcessRequest (HttpContext Context) {
try {
Context.Response.End();
}
catch(ThreadAbortException) {
}
}
}
有什么想法吗?