0
我有一个HttpModule,这样的事情:的HttpModule的AcquireRequestState事件处理程序都是空发件人
public class MyModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.AcquireRequestState += Context_OnAcquireRequestState;
}
private void Context_OnAcquireRequestState(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;
... etc
}
}
我已经注意到了应用程序池后直接发生的问题重新启动,其中null被作为发件人通过AcquireRequestState事件的参数,我得到一个空引用异常。 经过一段时间后,问题似乎自行解决。
这怎么会发生?
我不太确定我会关心它是如何发生的,因为我只是处理它,ala if(Sender!= null) – 2009-12-18 01:54:26
但是我需要HttpModule来运行 - 这很重要! – cbp 2009-12-18 12:06:40