I'm including my stack track so you can see exactly what calls are being made...
I think this is due to me using the SessionSource... I have a UnitOfWork setup remarkably like FubuMVC-Contrib's I have come to find out: http://code.google.com/p/fubumvc-contrib/source/browse/trunk/samples/AltOxite/AltOxite.Core/Persistence/NHibernateUnitOfWork.cs The error is occurring when I am creating a new SessionSource, which is then consumed by my UnitOfWork. Creating a SessionSource appears to be triggering a SqlConnection.Open. I'm assuming I missed something along the way that said not to do this (with SessionSource) and to do it with SessionFactory... StructureMap.StructureMapException: StructureMap Exception Code: 207 Internal exception while creating Instance 'd3432015-2b17-4265-8ea6- bde8a68de0e7' of PluginType FluentNHibernate.ISessionSource, FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880. Check the inner exception for more details. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at NHibernate.Connection.DriverConnectionProvider.GetConnection() at NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) at NHibernate.Cfg.Configuration.BuildSessionFactory() at FluentNHibernate.SessionSource.Initialize(Configuration nhibernateConfig, PersistenceModel model) in d:\Builds\FluentNH\src \FluentNHibernate\SessionSource.cs:line 47 at FluentNHibernate.SessionSource..ctor(IDictionary`2 properties, PersistenceModel model) in d:\Builds\FluentNH\src\FluentNHibernate \SessionSource.cs:line 30 at SAAM.Data.FluentNHibernate.SessionSourceConfiguration.CreateSessionSource(PersistenceModel model) in C:\eTouch\SAAM\src\SAAM.Data\FluentNHibernate \SessionSourceConfiguration.cs:line 42 at SAAM.Website.Bootstrapper.<BootstrapStructureMap>b__2(IContext context) in C:\eTouch\SAAM\src\SAAM.Website\Bootstrapper.cs:line 170 at StructureMap.Pipeline.ConstructorInstance`1.build(Type pluginType, BuildSession session) On Feb 13, 4:21 pm, Beefy <[email protected]> wrote: > Well, StructureMap is building an ISessionSource instance actually... > > Then my module, on BeginRequest, calls gets an instance of an > encapsulating class I use called NHibernateUnitOfWork, and calls an > initialize function that calls CreateSession on the SessionSource and > manages the transactions per request to it. The way I'm reading this, > a session shouldn't ever be instantiated until the Request is made... > which may be the case... this error may actually be StructureMap > catching theSQLtimeoutexception from the ISessionSource timing out > when trying to create the session at CreateSession().... Such sessions > should always be disposed at the end of a request though... > > Again, this only occurs when I rebuild the application, and then only > the first few times I try to hit it... I'm leaning toward there being > a hanging connection to theSQLserver that's tied to the old build, > and the new one has to wait until that hanging connection times out > before it will allow the new one to make a connection... I'm just not > sure why it would be hanging from my current setup... and I don't know > where to look to figure this out. > > / Michael / > > On Feb 13, 3:26 pm, Jason Meckley <[email protected]> wrote: > > > you setup the session or session factory in application start? you > > should be creating the session factory in the application start. > > sessions should be scoped to each request which can be managed by the > > http module. > > Are you issuing any queries on application start? if so are they > > efficient queries? how much data is being retrieved? > > > On Feb 13, 12:16 pm, Beefy <[email protected]> wrote: > > > > I have a web app that uses Fluent NHibernate and StructureMap for IoC. > > > I have an issue where upon some builds of the app, the first few times > > > I hit the web site I will get aSQLconnectiontimeouterror. After > > > those first two or three times, everything is fine. The ISession is > > > being setup by StructureMap at Application_Start time. I then have an > > > HttpModule that handles all session commits, etc. The build seems to > > > (sometimes, not all times) trigger a hanging connection or something > > > that has to time out before the new build of the web app can establish > > > a connection. > > > > Does anyone have a minute to shed some light on my issue for me so > > > that I can avoid this problem on new deployments of the app in the > > > future? > > > > / Michael / -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
