Orchard CMS重复内容错误 [英] Orchard CMS Duplicate Content Error
问题描述
我们有一个使用Orchard CMS v1.8构建的网站.我们有一些实例,其中管理内容的人无法将更改保存到页面.他们收到以下错误.
We have a web site built with Orchard CMS v1.8. We have had a couple of instances where the person that manages content has not been able to save changes to a Page. They receive the following error.
发生未处理的异常,请求被终止.请刷新页面.如果错误仍然存在,请返回 序列包含多个匹配元素 System.InvalidOperationException:序列在System.Linq.Enumerable.SingleOrDefault [TSource](IEnumerable
1 source, Func
2谓词)处包含多个匹配元素,位于c:\ Orchard \ src \中的Orchard.ContentManagement.DefaultContentManager.BuildNewVersion(ContentItem existingContentItem). Orchard.ContentManagement.DefaultContentManager.Get上的Orchard \ ContentManagement \ DefaultContentManager.cs:第450行Orchard.Core上c:\ Orchard \ src \ Orchard \ ContentManagement \ DefaultContentManager.cs:第234行的Orchard.ContentManagement.DefaultContentManager.Get(Int32 id,VersionOptions选项,QueryHints提示) .Contents.Controllers.AdminController.EditPOST(Int32 id,String returnUrl,Action1 conditionallyPublish) in c:\Orchard\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 308 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2参数)位于System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult)在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocation处在System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters中的WithFilters.b__3f().System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters中的c__DisplayClass48.b__41(). Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<> c__DisplayClass48.b__41()
An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back Sequence contains more than one matching element System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable
1 source, Func
2 predicate) at Orchard.ContentManagement.DefaultContentManager.BuildNewVersion(ContentItem existingContentItem) in c:\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 450 at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in c:\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 234 at Orchard.Core.Contents.Controllers.AdminController.EditPOST(Int32 id, String returnUrl, Action1 conditionallyPublish) in c:\Orchard\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 308 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41()
我该怎么做才能消除SingleOrDefault()调用中返回的额外记录?我不知道Orchard背后的数据库结构足以找到内容记录",但如果能够找到它们,则可以删除多余的记录.
What can I do to elimiate the extra record(s) returned in the SingleOrDefault() call? I don't know the database structure behind Orchard enough to find the "content records" but if I was able to find them I could delete the extra record(s).
谢谢!
推荐答案
此错误的原因是,您具有一个值Latest = 1
的相同内容项有多个版本(果园使用此值来确定最新版本)内容项),为解决该问题,您可以运行以下查询以查找重复的版本:
The cause for this error that you have more than one version of the same content item with value Latest = 1
(orchard use this value to determine the latest version for content item), to solve it you can run the following query to find the duplicate versions:
SELECT *
FROM Orchard_Framework_ContentItemVersionRecord
WHERE ContentItemRecord_id = @Id
然后确保只有一个值Latest = 1
,published = 1
和Number
的记录按顺序排列,没有重复.
then be sure that there is only one record with value Latest = 1
, published = 1
, and Number
is in sequence without duplicates.
仅供参考,在查询中,对于有错误的内容项目,请使用值Id
.
FYI, in query use value Id
for content item which has the error.
这篇关于Orchard CMS重复内容错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!