I have a web service implemented in ASP.NET.
I instantiate my NHibernate session in the Global.asax event handlers as follows:
protected void Application_BeginRequest(object sender, EventArgs e)
{
NHibernateInitializer.Instance().InitializeNHibernateOnce(
() => InitializeNHibernateSession());
}
private void InitializeNHibernateSession()
{
NHibernateSession.Init(
webSessionStorage,
new string[] { Server.MapPath("~/bin/DAL.Server.Data.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"));
}
My problem is, whenever I need to update the NHibernate.config connection string to connect to a different database (for testing purpose, on the deployment server) NHibernate still maintain the connection to the previously connected DB.
Only restarting IIS can resolve this problem. Does anyone have any idea if this is due to come kind of caching in IIS? or some settings I have missed out? Thanks in advance!