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
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>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With