I am getting this error whenever my S#arp Architecture attempts to start and this is an problem with SQL Server (for example: SQL Server is not runing), af开发者_运维问答ter I start SQL Server and hit refresh, I get this error:
A storage mechanism has already been configured for this application
NHibernateSession.Init()
or InitStorage()
is being called more than once. You're probably calling it every request, it's supposed to be called only once at startup.
In an old application I have to maintain, this happened when the application start had issues. So I just had to recycle the application pool in IIS.
Try to add this line before calling NHibernateSession.Init() to clear any previous initiation.
try{ NHibernateSession.Reset(); } catch { }
精彩评论