NHibernate的会议与IIS 7 [英] NHibernate Session with IIS 7

查看:136
本文介绍了NHibernate的会议与IIS 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用NHibernate一个ASP.NET MVC应用程序,该应用程序通过VS2008虚拟Web服务器上运行,当它运行良好,但是当我试图通过我的本地IIS服务器上运行的网站,我不断收到此错误的NHibernate:没有绑定到会话当前上下文。我不知道发生了什么。我缺少的东西吗?我只是有我的IIS默认网站指向应用程序的web目录中运行Default.aspx页。有任何想法吗?谢谢

I have a ASP.NET MVC application using NHibernate and the application runs fine when running it through VS2008 virtual web server, but when I tried running the site through my local IIS server I keep getting this NHibernate error: No session bound to the current context. I don't know what happened. Am I missing something? I just have my IIS Default Website pointing to the application's web directory where it runs the Default.aspx page. Any ideas? Thanks

推荐答案

您有一个HttpHandler或HTTP模块管理你的环境? IIS7需要在web.config中为这些不同的配置组。

Are you managing your context with an HttpHandler or HttpModule? IIS7 requires a different configuration group in the web.config for these.

<system.webServer>
 <modules></modules>
 <handlers></handlers>
</system.webServer>

这应该去外面的&LT;的System.Web /方式&gt; 节点

您可能有一个&LT; HttpHandlers的/&GT; &LT;的HttpModules /&GT; 部分已,这些与IIS6工作,但不是IIS7除非你是在传统模式下运行。

You probably have an <httpHandlers /> and <httpModules /> section already, these work with IIS6, but not IIS7 unless you are running in the legacy mode.

也可以,如果你结束你的会话时,EndRequest事件被触发,它是由一个图像或其他静态资源,这将有其请求最终调用您的操作方法之前的请求被解雇。

It is also possible that if you are ending your session when the EndRequest event is fired, that it is being fired by a request for an image or other static resource which will have its request end before the call to your action method.

这篇关于NHibernate的会议与IIS 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆