Using NhibernateProfiler we have determined that we are creating an ISession for every http request. However the ISessions never close. We can see in the log where localSession.Close() fires. Is there something in our config file that would cause the session to never close? Are there any other reasons localSession.Close() would not physical close the session? We are on 2.1 of NHibernate.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">JCDCHelper.DAL.Utilities.JCDCConnectionProvider, JCDCHelper.DAL</property>
<property name="dialect">NHibernate.Dialect.Sybase</property>
<property name="connection.release_mode">on_close</property>
<property name="show_sql">true</property>
<property name="connection.driver_class">JCDCHelper.DAL.Utilities.DataDirectSybaseDriver, JCDCHelper.DAL</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="connection.connection_string_name">ProdSybase</property>
<property name="current_session_context_class">web</property>
</session-factory>
</hibernate-configuration>
Thanks for taking the time to read this.
Are you Disposing the ISession? Wrapping it in a using statement?