问题描述
这是又一个在开发服务器,为什么不工作在IIS工作式的问题。
This is just another "working in dev server, why not working in IIS" type question.
我在使用NHibernate这里描述一个不错的DAL >。当创建一个ISession,我勾了一个事件处理程序HttpApplication.EndRequest采取清除它的照顾。
I created a nice DAL using NHibernate as described here. When creating an ISession, I hook up an event handler to the HttpApplication.EndRequest to take care of cleaning it up.
不过,我部署我的网站IIS和它说:
However, I deployed my site to IIS and it says:
事件处理程序只能在IHttpModule的初始化被绑定到HttpApplication的事件。
我彻底明白了什么消息说,但我不能undestrand为什么。
I completely understand what the message is saying, but I can't undestrand why.
我可以订阅一个按钮
的活动在任何时候,我为什么不能订阅的事件的的HttpApplication
?
I can subscribe to a Button
's event in any time, why can't I subscribe to an event of the HttpApplication
?
我会很感激,如果有人可以提供一些线索这光。
I would be very grateful if someone could shed some light on this.
和我还纳闷,为什么它的开发服务器,而不是与IIS 7的工作?
And I also wonder, why is it working with the development server and not with IIS 7?
编辑:现在,两个月过去了,我还没有得到任何有用的答案。 :(
这是问题真的那么难?
Now that two months has passed, I still haven't received any useful answers. :(
Is this issue really that hard?
推荐答案
您正在尝试使用的HttpApplication初始化管道之外。只是不这样做。正如错误说,在IHttpModule的初始化绑定您的活动。
You're trying to use the HttpApplication outside its initialization pipeline. Just don't do it. As the error says, bind your events during IHttpModule initialization.
这篇关于为什么事件处理程序只能在IHttpModule的初始化被绑定到HttpApplication的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!