【问题标题】:Sitecore: argument out of range when page editor is enabledSitecore:启用页面编辑器时参数超出范围
【发布时间】:2015-07-10 21:35:37
【问题描述】:

目前唯一的目标是顺利运行 Sitecore 页面编辑器。错误来自以下 URL:

http://localhost/sitecore/shell/Applications/WebEdit/WebEditRibbon.aspx?db=master&id={guid}&la=en&vs=1&url=%2F&mode=edit&sc_pagesite=website&trf=%2Ftemp%2Fdiagnostics%2Ftrace_{guid}.xml&prf=%2Ftemp%2Fdiagnostics%2Fprofile_{guid}.xml&dev={guid}

在启用页面编辑器的情况下打开任何页面时出现此异常:

16028 13:57:46 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.sitecore_shell_applications_webedit_webeditribbon_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3d565cb3\44f479ba\App_Web_pyaedh12.0.cs:line 0
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Nested Exception

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.CallMethod(Type type, Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Boolean includeStatic, Object[] parameters)
   at Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Nested Exception

Exception: System.ArgumentOutOfRangeException
Message: startIndex cannot be larger than length of string.
Parameter name: startIndex
Source: mscorlib
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Sitecore.Links.LinkProvider.LinkBuilder.GetItemPathElement(Item item, SiteInfo site)
   at Sitecore.Links.LinkProvider.LinkBuilder.BuildItemUrl(Item item)
   at Sitecore.Links.LinkProvider.GetItemUrl(Item item, UrlOptions options)
   at Sitecore.Providers.LinkProvider.GetItemUrl(Item item, UrlOptions options)
   at Sitecore.Web.WebEditUtil.GetItemUrl(Item item)
   at Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.RenderTreecrumbGo(HtmlTextWriter output, Item item)
   at Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.RenderTreecrumb(Item item)
   at Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.OnLoad(EventArgs e)

禁用页面编辑器时页面呈现正常。

运行版本:

  • Sitecore 7.2。
  • ASP.NET MVC 5.2.3(也尝试过 5.1.3)。

我已尝试在布局/渲染中删除与 Sitecore 相关的任何内容,但该错误仍然存​​在。我意识到如果不查看配置文件就不可能弄清楚发生了什么,但希望有人曾经偶然发现过这个错误!

谢谢!

【问题讨论】:

  • 是字面网址吗?其中没有任何实际的 GUID,这将是一个问题。另外,您正在编辑的网站是否在 web.config 中称为“网站”?
  • 不,这不是文字 URL,我只是“隐藏”了 GUID。是的,它是一个叫做“网站”的网站,我已将 rootPath 属性更改为/sitecore/content/foo/bar

标签: asp.net asp.net-mvc sitecore sitecore7.2


【解决方案1】:

问题在于 rootPath 属性。看来它不能低于/sitecore/content 的两个级别。当我将它从 /sitecore/content/foo/bar 更改为 /sitecore/content/foo 时,它再次起作用。希望 Sitecore 资深人士能够解释这是为什么!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多