Prepare requires an open and available Connection. The connection's current state is closed.

Topics: General
May 3, 2014 at 9:14 PM
Has anyone come across this error. I've spent the day trying to resolve issues with Orchard 1.7.2 running on Azure under even a small amount of load, with some luck, having patched in some of the changes since it's release.

Currently hitting this issue on my blog pages occasionally, which stops the blog from rendering until I restart the site.

[InvalidOperationException: Prepare requires an open and available Connection. The connection's current state is closed.]
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.Prepare()
at NHibernate.SqlAzure.ReliableSqlCommand.Prepare() in c:\TeamCity\buildAgent\work\99f31db0d548c7b7\NHibernate.SqlAzure\ReliableSqlCommand.cs:line 65
at NHibernate.Driver.DriverBase.PrepareCommand(IDbCommand command) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Driver\DriverBase.cs:line 281
at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 113

[ADOException: While preparing SELECT TOP (@p0) this_.Id as Id34_3_, this_.Number as Number34_3_, this_.Published as Published34_3_, this_.Latest as Latest34_3_, this_.Data as Data34_3_, this_.ContentItemRecord_id as ContentI6_34_3_, autoroutep1_.Id as Id86_0_, autoroutep1_.UseCustomPattern as UseCusto2_86_0_, autoroutep1_.CustomPattern as CustomPa3_86_0_, autoroutep1_.DisplayAlias as DisplayA4_86_0_, autoroutep1_.ContentItemRecord_id as ContentI5_86_0_, contentite4_.Id as Id30_1_, contentite4_.Data as Data30_1_, contentite4_.ContentType_id as ContentT3_30_1_, contenttyp5_.Id as Id32_2_, contenttyp5_.Name as Name32_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Autoroute_AutoroutePartRecord autoroutep1_ on this_.Id=autoroutep1_.Id left outer join Orchard_Framework_ContentItemRecord contentite4_ on this_.ContentItemRecord_id=contentite4_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp5_ on contentite4_.ContentType_id=contenttyp5_.Id WHERE autoroutep1_.DisplayAlias = @p1 and this_.Published = @p2 an error occurred]
at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 117
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 216
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1224
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 421
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 251
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1569
at NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor session, QueryParameters queryParameters, ISet1 querySpaces, IType[] resultTypes) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1486
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet
1 querySpaces, IType[] resultTypes) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1465
at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaLoader.cs:line 76
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 1975
at NHibernate.Impl.CriteriaImpl.List(IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 265
at NHibernate.Impl.CriteriaImpl.ListT in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 276
at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 162
at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.Slice(Int32 skip, Int32 count) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 216
at Orchard.Autoroute.Services.PathResolutionService.GetPath(String path)
at Orchard.Blogs.Routing.ArchiveConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.ProcessConstraint(HttpContextBase httpContext, Object constraint, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.ProcessConstraints(HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.GetRouteData(HttpContextBase httpContext)
at Orchard.Mvc.Routes.ShellRoute.GetRouteData(HttpContextBase httpContext) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\Mvc\Routes\ShellRoute.cs:line 49
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
May 3, 2014 at 9:30 PM
Actually it appears to be preceeded by which looks to be the culprit:

NHibernate.Exceptions.GenericADOException: The connection is broken and recovery is not possible. The connection is marked by the server as unrecoverable. No attempt was made to restore the connection.

[SqlException: The connection is broken and recovery is not possible. The connection is marked by the server as unrecoverable. No attempt was made to restore the connection.]
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.SqlConnection.ValidateAndReconnect(Action beforeDisconnect, Int32 timeout)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.ReliableSqlConnection.<>c__DisplayClassc1.<ExecuteCommand>b__a() in :line 0
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func
1 func) in :line 0
at Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.ReliableSqlConnection.<>c__DisplayClassc1.<ExecuteCommand>b__9() in :line 0
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0() in :line 0
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func
1 func) in :line 0
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Action action) in :line 0
at Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.ReliableSqlConnection.ExecuteCommand[T](IDbCommand command, RetryPolicy retryPolicy, CommandBehavior behavior) in :line 0
at Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.ReliableSqlConnection.ExecuteCommand[T](IDbCommand command) in :line 0
at NHibernate.SqlAzure.ReliableSqlCommand.ExecuteReader() in c:\TeamCity\buildAgent\work\99f31db0d548c7b7\NHibernate.SqlAzure\ReliableSqlCommand.cs:line 85
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 229
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1224
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 421
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 251
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1564

[GenericADOException: could not execute query [ SELECT TOP (@p0) this_.Id as Id34_3_, this_.Number as Number34_3_, this_.Published as Published34_3_, this_.Latest as Latest34_3_, this_.Data as Data34_3_, this_.ContentItemRecord_id as ContentI6_34_3_, autoroutep1_.Id as Id86_0_, autoroutep1_.UseCustomPattern as UseCusto2_86_0_, autoroutep1_.CustomPattern as CustomPa3_86_0_, autoroutep1_.DisplayAlias as DisplayA4_86_0_, autoroutep1_.ContentItemRecord_id as ContentI5_86_0_, contentite4_.Id as Id30_1_, contentite4_.Data as Data30_1_, contentite4_.ContentType_id as ContentT3_30_1_, contenttyp5_.Id as Id32_2_, contenttyp5_.Name as Name32_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Autoroute_AutoroutePartRecord autoroutep1_ on this_.Id=autoroutep1_.Id left outer join Orchard_Framework_ContentItemRecord contentite4_ on this_.ContentItemRecord_id=contentite4_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp5_ on contentite4_.ContentType_id=contenttyp5_.Id WHERE autoroutep1_.DisplayAlias = @p1 and this_.Published = @p2 ] Name:cp0 - Value:blog Name:cp1 - Value:True [SQL: SELECT TOP (@p0) this_.Id as Id34_3_, this_.Number as Number34_3_, this_.Published as Published34_3_, this_.Latest as Latest34_3_, this_.Data as Data34_3_, this_.ContentItemRecord_id as ContentI6_34_3_, autoroutep1_.Id as Id86_0_, autoroutep1_.UseCustomPattern as UseCusto2_86_0_, autoroutep1_.CustomPattern as CustomPa3_86_0_, autoroutep1_.DisplayAlias as DisplayA4_86_0_, autoroutep1_.ContentItemRecord_id as ContentI5_86_0_, contentite4_.Id as Id30_1_, contentite4_.Data as Data30_1_, contentite4_.ContentType_id as ContentT3_30_1_, contenttyp5_.Id as Id32_2_, contenttyp5_.Name as Name32_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Autoroute_AutoroutePartRecord autoroutep1_ on this_.Id=autoroutep1_.Id left outer join Orchard_Framework_ContentItemRecord contentite4_ on this_.ContentItemRecord_id=contentite4_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp5_ on contentite4_.ContentType_id=contenttyp5_.Id WHERE autoroutep1_.DisplayAlias = @p1 and this_.Published = @p2]]
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1573
at NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor session, QueryParameters queryParameters, ISet1 querySpaces, IType[] resultTypes) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1486
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet
1 querySpaces, IType[] resultTypes) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:line 1465
at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaLoader.cs:line 76
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 1975
at NHibernate.Impl.CriteriaImpl.List(IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 265
at NHibernate.Impl.CriteriaImpl.ListT in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 276
at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 162
at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.Slice(Int32 skip, Int32 count) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 216
at Orchard.Autoroute.Services.PathResolutionService.GetPath(String path)
at Orchard.Blogs.Routing.ArchiveConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.ProcessConstraint(HttpContextBase httpContext, Object constraint, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.ProcessConstraints(HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)
at System.Web.Routing.Route.GetRouteData(HttpContextBase httpContext)
at Orchard.Mvc.Routes.ShellRoute.GetRouteData(HttpContextBase httpContext) in C:\Working\Development\ClairEstellePhotography2014\src\Orchard\Mvc\Routes\ShellRoute.cs:line 49
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
May 4, 2014 at 9:23 AM
Having left the site go over night currently what happens is that "NHibernate.Exceptions.GenericADOException: The connection is broken and recovery is not possible. The connection is marked by the server as unrecoverable. No attempt was made to restore the connection." always occurs and then after for hit too the blog pages I get a InvalidOperationException: Prepare requires an open and available Connection. The connection's current state is closed

Analysing the StackTrace there are only 4 pieces of Orchard source that are in use here the rest is either System.Web or NHibernate.

So digging in to the Orchard components I can see that ArchiveConstraint interface IArchiveContstraint is marked to be singleton using ISingletonDependency. Whereas the dependency it has IPathResolutionService is a per request dependency.

My assumption is that as ArchiveContraint is a singleton what ever underlying connection is marked as closed is never cleaned up and reopened, I'm going to try marking IArchiveConstraint just as IDependency as see if this helps. I would assume I'll still see the "connection is broken" exception but the no more of the other one.
Coordinator
May 5, 2014 at 5:42 PM
I have changed that in the latest source, now it's using IAliasHolder to check the constraints, which is a singleton, AND doesn't need any request.
Another improvement is that AliasUpdater is a feature, which means you can disable it if you don't need it. It's disabled by default on new installs. It will also spare you some sql queries.
May 29, 2014 at 5:36 AM
@sebastienros What did you change to use IAliasHolder? Is IArchiveConstraint now inheriting from IAliasHolder?

I am having the same issue described above...

Thank you.
Jun 5, 2014 at 4:56 PM
Edited Jun 5, 2014 at 4:56 PM
I am still getting this issue, even tough I am using Orchard 1.8.

Here is part of the exception:
[InvalidOperationException: Prepare requires an open and available Connection. The connection's current state is closed.]
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +5345098
   System.Data.SqlClient.SqlCommand.Prepare() +542
   NHibernate.SqlAzure.ReliableSqlCommand.Prepare() in c:\TeamCity\buildAgent\work\99f31db0d548c7b7\NHibernate.SqlAzure\ReliableSqlCommand.cs:65
   NHibernate.Driver.DriverBase.PrepareCommand(IDbCommand command) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Driver\DriverBase.cs:281
   NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:109

[ADOException: While preparing SELECT TOP (@p0)  this_.Id as Id1979_3_, this_.Number as Number1979_3_, this_.Published as Published1979_3_, this_.Latest as Latest1979_3_, this_.Data as Data1979_3_, this_.ContentItemRecord_id as ContentI6_1979_3_, autoroutep1_.Id as Id2019_0_, autoroutep1_.UseCustomPattern as UseCusto2_2019_0_, autoroutep1_.CustomPattern as CustomPa3_2019_0_, autoroutep1_.DisplayAlias as DisplayA4_2019_0_, autoroutep1_.ContentItemRecord_id as ContentI5_2019_0_, contentite4_.Id as Id1978_1_, contentite4_.Data as Data1978_1_, contentite4_.ContentType_id as ContentT3_1978_1_, contenttyp5_.Id as Id1980_2_, contenttyp5_.Name as Name1980_2_ FROM orchard_Orchard_Framework_ContentItemVersionRecord this_ inner join orchard_Orchard_Autoroute_AutoroutePartRecord autoroutep1_ on this_.Id=autoroutep1_.Id left outer join orchard_Orchard_Framework_ContentItemRecord contentite4_ on this_.ContentItemRecord_id=contentite4_.Id left outer join orchard_Orchard_Framework_ContentTypeRecord contenttyp5_ on contentite4_.ContentType_id=contenttyp5_.Id WHERE autoroutep1_.DisplayAlias = @p1 and this_.Published = @p2 an error occurred]
   NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:117
   NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:216
   NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:1224
   NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:419
   NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:251
   NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:1569
   NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:1472
   NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Loader.cs:1465
   NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:1975
   NHibernate.Impl.CriteriaImpl.List(IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:265
   NHibernate.Impl.CriteriaImpl.List() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:276
   Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) +247
   Orchard.ContentManagement.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.Slice(Int32 skip, Int32 count) +74
   Orchard.Autoroute.Services.PathResolutionService.GetPath(String path) +335
   Orchard.Blogs.Routing.ArchiveConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +131
   System.Web.Routing.Route.ProcessConstraint(HttpContextBase httpContext, Object constraint, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +56
   System.Web.Routing.Route.ProcessConstraints(HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection) +100
   System.Web.Routing.Route.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +108
   Orchard.Mvc.Routes.ShellRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +356
   Orchard.Mvc.Routes.HubRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +275
   System.Web.Routing.RouteCollection.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +96
   System.Web.Mvc.RouteCollectionExtensions.GetVirtualPathForArea(RouteCollection routes, RequestContext requestContext, String name, RouteValueDictionary values, Boolean& usingAreas) +258
   System.Web.Mvc.UrlHelper.GenerateUrl(String routeName, String actionName, String controllerName, RouteValueDictionary routeValues, RouteCollection routeCollection, RequestContext requestContext, Boolean includeImplicitMvcValues) +90
   System.Web.Mvc.UrlHelper.Action(String actionName, String controllerName, Object routeValues) +40
   Orchard.Blogs.Extensions.UrlHelperExtensions.BlogArchiveMonth(UrlHelper urlHelper, BlogPart blogPart, Int32 year, Int32 month) +201
   ASP.<>c__DisplayClass12.<Execute>b__d(KeyValuePair`2 t, Int32 i) in d:\home\site\wwwroot\Modules\Orchard.Blogs\Views\Parts.Blogs.BlogArchives.cshtml:37
   Orchard.Mvc.Html.HtmlHelperExtensions.UnorderedList(IEnumerable`1 items, Func`3 generateContent, String cssClass, Func`2 generateItemCssClass, Func`2 generateAlternatingItemCssClass) +1174
   Orchard.Mvc.Html.HtmlHelperExtensions.UnorderedList(HtmlHelper htmlHelper, IEnumerable`1 items, Func`3 generateContent, String cssClass, String itemCssClass, String alternatingItemCssClass) +333
   Orchard.Mvc.Html.HtmlHelperExtensions.UnorderedList(HtmlHelper htmlHelper, IEnumerable`1 items, Func`3 generateContent, String cssClass) +104
   ASP._Page_Modules_Orchard_Blogs_Views_Parts_Blogs_BlogArchives_cshtml.Execute() in d:\home\site\wwwroot\Modules\Orchard.Blogs\Views\Parts.Blogs.BlogArchives.cshtml:37
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +277
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +91
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +33
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) +332
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) +160
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) +134
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) +220
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) +1885
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) +270
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) +205
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) +128
   CallSite.Target(Closure , CallSite , Object , Object ) +193
   Orchard.Core.Shapes.CoreShapes.ContentZone(Object Display, Object Shape, TextWriter Output) +1352
Aug 20, 2014 at 11:45 AM
Edited Aug 20, 2014 at 11:57 AM
I am also seeing this same error. Our environment (in case that is part of the cause) is also Azure.
Orchard 1.8.1 running as a cloud service on Azure (single instance) with config files stored in blob storage to be shared across instances.
Azure SQL Database (Web 1GB)
Virtual Private Network which hosts the cloud service.

While the website works, there are performance issues as well as some data loads incorrectly. Also, we cannot disable or enable any modules via the Admin portal. No error message is generated, and no response message is displayed. The page just refreshes.

Logging to ElasticSearch
==========================================================
Exception
NHibernate.TransactionException: Transaction not connected, or was disconnected
   at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
   at NHibernate.Transaction.AdoTransaction.Rollback()
   at Orchard.Data.SessionLocator.Dispose()
-------------------------------------------------------------------------------------------------------------------
stacktrace         
at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
   at NHibernate.Transaction.AdoTransaction.Rollback()
   at Orchard.Data.SessionLocator.Dispose()
Also, we have enabled Cloud Services access to our databases