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
R – NHibernate Session with IIS 7
asp.net-mvciis-7nhibernate
Related Topic
- IIS7 Permissions Overview – ApplicationPoolIdentity
- IIS 500.19 with 0x80070005 The requested page cannot be accessed because the related configuration data for the page is invalid error
- Config Error: This configuration section cannot be used at this path
- Asp.net-mvc – Visual Studio debugging/loading very slow
- WebApi’s {“message”:”an error has occurred”} on IIS7, not in IIS Express
- C# – ASP.NET 5 MVC: unable to connect to web server ‘IIS Express’
Best Answer
Are you managing your context with an HttpHandler or HttpModule? IIS7 requires a different configuration group in the web.config for these.
This should go outside the
<system.web />
node.You probably have an
<httpHandlers />
and<httpModules />
section already, these work with IIS6, but not IIS7 unless you are running in the legacy mode.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.