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.
精彩评论