带有 WaitHandle 的 HttpHandler 中的 NullReferenceException
NullReferenceException in HttpHandler with WaitHandle
我有一个带有长轮询 IHttpAsyncHandler 的遗留 Web 表单应用程序,该应用程序开始在事件日志中引发异常,但信息很少。如果长轮询 XMLHttpRequest 挂起并且我对 web.config 进行了更改,我可以在 IIS Express 中重现错误。这会回收进程,并在调试器和事件日志中引发相同的 NullReferenceException:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 05/06/2020 2:30:09 PM
Event time (UTC): 05/06/2020 6:30:09 PM
Event ID: c8428fb2935c47be90ebc6a7849063e6
Event sequence: 7
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2/ROOT/WebApp-2-132358551451863719
Trust level: Full
Application Virtual Path: /WebApp
Application Path: C:\Users\naask\source\repos\WebApp\
Machine name: DESKTOP-S7T1J31
Process information:
Process ID: 11892
Process name: iisexpress.exe
Account name: DESKTOP-S7T1J31\naask
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://localhost:48061/WebApp/edits?id=~/somepath.aspx/26264&wait=true
Request path: /WebApp/edits
User host address: ::1
User:
Is authenticated: False
Authentication Type:
Thread account name: DESKTOP-S7T1J31\naask
Thread information:
Thread ID: 6
Thread account name: DESKTOP-S7T1J31\naask
Is impersonating: False
Stack trace: at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
在调试器中,它尝试加载符号信息但失败:
异常信息与事件日志数据匹配:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
大概我正在寻找的符号在 System.Web 中,但我已经加载了这些符号并且我已经 setup VS to debug framework code:
我不确定从这里到哪里去调试 IHttpAsyncHandler 的问题。长轮询处理程序在信号量上使用 ThreadPool.RegisterWaitForSingleObject
来等待事件,并在该事件发生时同时释放所有等待者。我只在 AppPool 回收后才看到这些错误。
我从来没有找到解决缺失源问题的方法来对此进行调试,但在彻底减少案例后,问题的根源是通过 IHttpAsyncHandler 的路径,其中返回的 IAsyncResult 为空。
我有一个带有长轮询 IHttpAsyncHandler 的遗留 Web 表单应用程序,该应用程序开始在事件日志中引发异常,但信息很少。如果长轮询 XMLHttpRequest 挂起并且我对 web.config 进行了更改,我可以在 IIS Express 中重现错误。这会回收进程,并在调试器和事件日志中引发相同的 NullReferenceException:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 05/06/2020 2:30:09 PM
Event time (UTC): 05/06/2020 6:30:09 PM
Event ID: c8428fb2935c47be90ebc6a7849063e6
Event sequence: 7
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2/ROOT/WebApp-2-132358551451863719
Trust level: Full
Application Virtual Path: /WebApp
Application Path: C:\Users\naask\source\repos\WebApp\
Machine name: DESKTOP-S7T1J31
Process information:
Process ID: 11892
Process name: iisexpress.exe
Account name: DESKTOP-S7T1J31\naask
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://localhost:48061/WebApp/edits?id=~/somepath.aspx/26264&wait=true
Request path: /WebApp/edits
User host address: ::1
User:
Is authenticated: False
Authentication Type:
Thread account name: DESKTOP-S7T1J31\naask
Thread information:
Thread ID: 6
Thread account name: DESKTOP-S7T1J31\naask
Is impersonating: False
Stack trace: at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
在调试器中,它尝试加载符号信息但失败:
异常信息与事件日志数据匹配:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
大概我正在寻找的符号在 System.Web 中,但我已经加载了这些符号并且我已经 setup VS to debug framework code:
我不确定从这里到哪里去调试 IHttpAsyncHandler 的问题。长轮询处理程序在信号量上使用 ThreadPool.RegisterWaitForSingleObject
来等待事件,并在该事件发生时同时释放所有等待者。我只在 AppPool 回收后才看到这些错误。
我从来没有找到解决缺失源问题的方法来对此进行调试,但在彻底减少案例后,问题的根源是通过 IHttpAsyncHandler 的路径,其中返回的 IAsyncResult 为空。