Azure SQL 托管实例和本地 SQL 中的 Nhibernate 错误消息

问题描述 投票:0回答:1

有人遇到过类似的问题吗?使用 Orchard 多年后,下面的异常突然开始出现。该网站被锁定,一段时间内没有人能够浏览。 将 Nhibernate 升级到新版本会有帮助吗?我还应该考虑将 orchard Framework 升级到版本 1.10.3 吗? 由于预算原因,目前搬迁至 Orchard Core 是不可能的。 我还要提一下,我们没有使用 Orchard.sdf。我们正在从 Sql 托管实例和 Sql Server on Prem 中的数据库读取 orchard 设置。

当前 Orchard 框架版本:1.10.2 当前 Nhibernate 版本:4.0.4.4000

Exception NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Execution Timeout Expired.
  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Operation cancelled by user.
  The statement has been terminated. ---> System.ComponentModel.Win32Exception: The wait operation timed out
     --- End of inner exception stack trace ---
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
     at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
     at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
     at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
     at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
     --- End of inner exception stack trace ---
     at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
     at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
     at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()
     at NHibernate.Engine.ActionQueue.ExecuteActions()
     at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
     at NHibernate.Event.Default.DefaultAutoFlushEventListener.OnAutoFlush(AutoFlushEvent event)
     at NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet1 querySpaces)
     at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
     at NHibernate.Impl.CriteriaImpl.List(IList results)
     at NHibernate.Impl.CriteriaImpl.ListT
     at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count)
     at Orchard.ContentManagement.DefaultContentQuery.ContentQuery1.Orchard.ContentManagement.IContentQuery<T>.List()
     at Orchard.Widgets.Services.DefaultLayerEvaluationService.PopulateActiveLayers() in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Services\DefaultLayerEvaluationService.cs:line 45
     at Orchard.ContentManagement.Utilities.LazyField1.GetValue()
     at Orchard.ContentManagement.Utilities.LazyField1.get_Value()
     at Orchard.Widgets.Services.DefaultLayerEvaluationService.GetActiveLayerIds() in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Services\DefaultLayerEvaluationService.cs:line 38
     at Orchard.Widgets.Filters.WidgetFilter.OnResultExecuting(ResultExecutingContext filterContext) in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Filters\WidgetFilter.cs:line 52
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult)
     at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.b__1(IAsyncResult asyncResult) has been thrown in controller Tax.Core.Framework.Controllers.HomeController redirecting user to '~/Login/ApplicationError'

尝试使用托管 SQL 实例数据库中的属性。将“已提交读取”设置为 true 似乎对解决问题没有帮助。

nhibernate upgrade orchardcms sqlclient
1个回答
0
投票

我怀疑问题出在 Azure SQL 托管实例上,因为昨天微软在西欧对该资源进行计划维护后,我们遇到了完全相同的连接超时问题。如果将连接从连接池中取出,连接就可以工作,但是每当连接不在池中但必须建立时,我们通常会看到连接超时。这个问题突然开始了。

我们通过在应用程序连接字符串中添加

Min Pool Size=[number]
并将
[number]
设置为高于之前所需的数字来修复此问题。此后,应用程序不再需要创建新连接,而是重复使用池中的连接。

今天我们重新启动了 Azure SQL 托管实例,一切看起来又恢复正常了。可能不需要重新启动,无论如何今天情况看起来更好了。

© www.soinside.com 2019 - 2024. All rights reserved.