开发者

Event handlers can only be bound to HttpApplication events during IHttpModule initialization.

I followed this article:

Effective NHibernate Session management for web apps

But this:

public void Dispose()
{
    app.BeginRequest -= ContextBeginRequest;
    app.开发者_如何学运维EndRequest -= ContextEndRequest;
}

Return me this error:

Event handlers can only be bound to HttpApplication events during IHttpModule initialization.

Why? Can I Ignore these Dispose statements?


IHttpModule is tightly coupled with the application itself, so when the application is destroyed so is IHttpModule. Therefore there is no need to to unbind events, so it's safe to remove that code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜