.net - Orchard CMS 事务错误

标签 .net orchardcms orchardcms-1.6

我们的 Orchard 网站上经常随机出现以下错误。当在页面之间快速导航时,这种情况似乎最为普遍。日志中没有其他错误,因此我不确定如何找出根本原因。我们没有对 ODBC 或类似的东西做任何特殊的事情(这是 google 在搜索有关 Orchard 的错误时提出的)。

[TransactionException: The operation is not valid for the state of the transaction.]
   System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) +45
   System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) +159
   NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.EnlistInDistributedTransactionIfNeeded(ISessionImplementor session) +307
   NHibernate.Impl.AbstractSessionImpl.EnlistInAmbientTransactionIfNeeded() +24
   NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus() +23
   NHibernate.Impl.SessionImpl.CreateCriteria(Type persistentClass) +95
   Orchard.ContentManagement.DefaultContentManager.GetManyImplementation(QueryHints hints, Action`2 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:302
   Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:140
   Orchard.ContentManagement.ContentGetExtensions.Get(IContentManager manager, Int32 id, VersionOptions options, QueryHints hints) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\ContentExtensions.cs:160
   Orchard.Core.Settings.Services.SiteService.GetSiteSettings() in c:\Users\sebros\My Projects\Orchard\src\Orchard.Web\Core\Settings\Services\SiteService.cs:46
   Orchard.Settings.CurrentSiteWorkContext.Get(String name) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Settings\CurrentSiteWorkContext.cs:13
   Orchard.Environment.<>c__DisplayClass7`1.<FindResolverForState>b__2(IWorkContextStateProvider wcsp) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +69
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +179
   Orchard.Environment.WorkContextImplementation.FindResolverForState(String name) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +64
   Orchard.Environment.WorkContextImplementation.GetState(String name) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\WorkContextImplementation.cs:27
   Orchard.WorkContext.get_CurrentSite() in c:\Users\sebros\My Projects\Orchard\src\Orchard\WorkContext.cs:52
   Orchard.Widgets.Filters.WidgetFilter.OnResultExecuting(ResultExecutingContext filterContext) +1222
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +41
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +257
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +257
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +187
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +346
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +30
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +52
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +28
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +52
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +28
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +15
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +28
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +52
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +28
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:162
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +875
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +234

[TransactionAbortedException: The transaction has aborted.]
   at System.Transactions.TransactionStateAborted.CreateAbortingClone(InternalTransaction tx)
   at System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking)
   at System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)
   at System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)
   at System.Transactions.TransactionScope.PushScope()
   at System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption, TransactionOptions transactionOptions)
   at Orchard.Data.TransactionManager.Orchard.Data.ITransactionManager.Demand() in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\TransactionManager.cs:line 37
   at Orchard.Data.SessionLocator.For(Type entityType) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\SessionLocator.cs:line 31
   at Orchard.ContentManagement.DefaultContentManager.GetManyImplementation(QueryHints hints, Action`2 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 301
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 140
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 111
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 107
   at Orchard.Security.Providers.FormsAuthenticationService.GetAuthenticatedUser() in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\Providers\FormsAuthenticationService.cs:line 94
   at Orchard.Security.CurrentUserWorkContext.<Get>b__0[T](WorkContext ctx) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\CurrentUserWorkContext.cs:line 13
   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7`1.<FindResolverForState>b__5() in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\WorkContextImplementation.cs:line 37
   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\WorkContextImplementation.cs:line 28
   at Orchard.WorkContext.get_CurrentUser() in c:\Users\sebros\My Projects\Orchard\src\Orchard\WorkContext.cs:line 60
   at Orchard.Security.Authorizer.Authorize(Permission permission, IContent content, LocalizedString message) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\Authorizer.cs:line 72
   at Orchard.Security.Authorizer.Authorize(Permission permission) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\Authorizer.cs:line 60
   at Orchard.Security.SecurityFilter.OnAuthorization(AuthorizationContext filterContext) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\SecurityFilter.cs:line 24
   at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__19()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:line 162
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

编辑:

我今天还在日志中发现了以下错误...听起来像是 Orchard 中的某种多线程错误。

[InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.]
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand\ command)
at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String\ method, SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean\ async)
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.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes,\ Boolean callable, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters\ queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor\ session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters\ queryParameters)

[GenericADOException: could not execute query [ select providerco0_.Id as Id45_,\ providerco0_.IsEnabled as IsEnabled45_, providerco0_.DisplayName as DisplayN3_45_,\ providerco0_.ProviderName as Provider4_45_, providerco0_.ProviderIdKey as Provider5_45_,\ providerco0_.ProviderSecret as Provider6_45_, providerco0_.ProviderIdentifier\ as Provider7_45_ from NGM_OpenAuthentication_ProviderConfigurationRecord providerco0_\ where providerco0_.ProviderName=@p0 ] Name:p1 - Value:Google [SQL: select\ providerco0_.Id as Id45_, providerco0_.IsEnabled as IsEnabled45_, providerco0_.DisplayName\ as DisplayN3_45_, providerco0_.ProviderName as Provider4_45_, providerco0_.ProviderIdKey\ as Provider5_45_, providerco0_.ProviderSecret as Provider6_45_, providerco0_.ProviderIdentifier\ as Provider7_45_ from NGM_OpenAuthentication_ProviderConfigurationRecord providerco0_\ where providerco0_.ProviderName=@p0]]
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters\ queryParameters)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session,\ QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters\ queryParameters, ISet`1 querySpaces, IType[] resultTypes)
at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session,\ QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session,\ QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters,\ ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters\ queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression,\ QueryParameters parameters)
at NHibernate.Impl.ExpressionQueryImpl.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression,\ IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
at Orchard.Data.Repository`1.Get(Expression`1 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line 91
at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1\ predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line\ 60
at NGM.OpenAuthentication.Services.ProviderConfigurationService.Get(String\ providerName)
at NGM.OpenAuthentication.Services.OrchardOpenAuthClientProvider.GetClientData(String\ providerName)
at NGM.OpenAuthentication.Shapes.<Discover>b__3(IExternalAuthenticationClient\ client)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at NGM.OpenAuthentication.Shapes.Discover(ShapeTableBuilder builder)
at Orchard.DisplayManagement.Descriptors.DefaultShapeTableManager.<>c__DisplayClass10.<GetShapeTable>b__4(Meta`1\ bindingStrategy) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\DefaultShapeTableManager.cs:line 48
at Orchard.Caching.DefaultParallelCacheContext.<>c__DisplayClass5`2.<>c__DisplayClass7.<RunInParallel>b__1()\ in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultParallelCacheContext.cs:line\ 24
at Orchard.Caching.DefaultParallelCacheContext.TaskWithAcquireContext`1.Execute()\ in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultParallelCacheContext.cs:line\ 71
at Orchard.Caching.DefaultParallelCacheContext.<RunInParallel>b__2[T,TResult](ITask`1\ task) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultParallelCacheContext.cs:line\ 30
at System.Linq.Parallel.SelectQueryOperator`2.SelectQueryOperatorResults.GetElement(Int32\ index)
at System.Linq.Parallel.QueryResults`1.get_Item(Int32 index)
at System.Linq.Parallel.ArrayMergeHelper`1.ToArrayElement(Int32 index)
at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput&\ currentElement, Int32& currentKey)
at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Linq.Parallel.QueryTask.<.cctor>b__0(Object o)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

[AggregateException: One or more errors occurred.]
at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
at System.Linq.Parallel.SpoolingTask.SpoolForAll[TInputOutput,TIgnoreKey](QueryTaskGroupState\ groupState, PartitionedStream`2 partitions, TaskScheduler taskScheduler)
at System.Linq.Parallel.DefaultMergeHelper`2.System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
at System.Linq.Parallel.MergeExecutor`1.Execute()
at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2\ partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler\ taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2\ partitionedStream)
at System.Linq.Parallel.ForAllOperator`1.WrapPartitionedStream[TKey](PartitionedStream`2\ inputStream, IPartitionedStreamRecipient`1 recipient, Boolean preferStriping,\ QuerySettings settings)
at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream`2\ inputStream)
at System.Linq.Parallel.ScanQueryOperator`1.ScanEnumerableQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1\ recipient)
at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1\ recipient)
at System.Linq.Parallel.QueryOperator`1.GetOpenedEnumerator(Nullable`1 mergeOptions,\ Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
at System.Linq.Parallel.ForAllOperator`1.RunSynchronously()
at System.Linq.ParallelEnumerable.ForAll[TSource](ParallelQuery`1 source,\ Action`1 action)
at System.Linq.Parallel.ArrayMergeHelper`1.Execute()
at System.Linq.Parallel.QueryOperator`1.ExecuteAndGetResultsAsArray()
at System.Linq.ParallelEnumerable.ToArray[TSource](ParallelQuery`1 source)
at Orchard.Caching.DefaultParallelCacheContext.RunInParallel[T,TResult](IEnumerable`1\ source, Func`2 selector) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultParallelCacheContext.cs:line 27
at Orchard.DisplayManagement.Descriptors.DefaultShapeTableManager.<>c__DisplayClass10.<GetShapeTable>b__3(AcquireContext`1\ x) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\DefaultShapeTableManager.cs:line 42
at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:line 57
at Orchard.Caching.Cache`2.AddEntry(TKey k, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:line 27
at Orchard.Caching.Cache`2.<>c__DisplayClass2.<Get>b__0(TKey k) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:line 19
at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key,\ Func`2 addValueFactory, Func`3 updateValueFactory)
at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:line 17
at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2\ acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultCacheManager.cs:line\ 33
at Orchard.DisplayManagement.Descriptors.DefaultShapeTableManager.GetShapeTable(String\ themeName) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\DefaultShapeTableManager.cs:line 39

更新2: 新的堆栈跟踪:

[TransactionException: The operation is not valid for the state of the transaction.]
   System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) +53
   System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) +281
   NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.EnlistInDistributedTransactionIfNeeded(ISessionImplementor session) +469
   NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) +353
   NHibernate.Impl.SessionImpl.Get(String entityName, Object id) +454
   NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id) +372
   NHibernate.Impl.SessionImpl.Get(Object id) +389
   Orchard.Data.Repository`1.Get(Int32 id) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:87
   Orchard.ContentManagement.Handlers.<>c__DisplayClass1.<Loading>b__0(TRecord prior) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\Handlers\StorageFilter.cs:54
   Orchard.ContentManagement.Utilities.LazyField`1.GetValue() in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\Utilities\LazyField.cs:24
   Orchard.Users.Models.RegistrationSettingsPart.get_UsersCanRegister() +16
   ASP._Page_Modules_Orchard_Users_Views_LogOn_cshtml.Execute() in c:\Users\jeff_000\documents\visual studio 2012\projects\cabwithme.orchard\Modules\Orchard.Users\Views\LogOn.cshtml:4
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +158
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:137
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:118
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Users\sebros\My Projects\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71
   ClaySharp.<>c__DisplayClass16.<InvokeMember>b__13() in C:\Users\sebros\My Projects\Clay\src\ClaySharp\ClayBehaviorCollection.cs:29
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) in C:\Users\sebros\My Projects\Clay\src\ClaySharp\ClayBehaviorCollection.cs:13
   ASP._Page_Core_Shapes_Views_ShapeResult_Display_cshtml.Execute() in c:\Users\jeff_000\documents\visual studio 2012\projects\cabwithme.orchard\Core\Shapes\Views\ShapeResult\Display.cshtml:1
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
   Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:60
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

最佳答案

似乎 OpenAuthentication 模块在调用 NGM.OpenAuthentication.Shapes.Discover(ShapeTableBuilder builder) 期间正在执行一些数据库工作。 Orchard 在准备用于缓存的形状表时并行调用此方法。因此,它可能会也可能不会在与请求线程不同的线程上运行。如果不先抑制当前的 TransactionScope,任何数据库操作都不应该永远发生。

Orchard 1.6(及更早版本)在整个请求上使用环境事务 (TransactionScope)(它在请求开始和结束时开始和结束)。因此,可能(并且将会)出现请求线程在生成的线程之前完成的情况。这是完全正常的。但是...如果在该线程上执行数据库操作 - 它将失败,因为底层事务已经完成。

这不是 Orchard 错误,而是 OpenAuthentication 模块中可能存在的错误,因此最好联系其作者。但首先,尝试从存储库中获取最新的源代码(图库模块可能已经过时)并尝试重现。

关于.net - Orchard CMS 事务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16268287/

相关文章:

c# - 我看到的是真正的内存泄漏吗?

orchardcms - 是否可以在 Orchard 中创建向导?

orchardcms - 从 Orchard 中的食谱创建别名

c# - Orchard 自定义表单下拉列表

.net - 如何确定 MemberInfo 实例的可访问性?

c# - WCF 反序列化丢失子集合

c# - 减少数据库往返

javascript - 在输入字段中将 html 标签显示为 html

orchardcms - Orchard 1.7.2 自定义表单不保存数据

asp.net-mvc - 在 Orchard CMS 中使用 ShapeHelper 生成形状 - 找不到类型