1

我正在运行 Sitecore 6.6.0-Update 4,MVC。当我尝试加载内容编辑器时,除了 /WebResource.axd 和 /ScriptResource.axd 文件之外,所有资源都正常加载。这会在尝试加载富文本编辑器时导致错误,并且可能还会在其他地方导致错误。

我已经验证了 routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 存在于 Global.asax 中。我还有其他地方可以解决此问题吗?

这是从 Fiddler 检索到的错误消息之一的副本:

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

Specified method is not supported. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NotSupportedException: Specified method is not supported. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[NotSupportedException: Specified method is not supported.] 
System.Web.Routing.StopRoutingHandler.GetHttpHandler(RequestContext requestContext) +36 
Sitecore.Mvc.Routing.RouteHandlerWrapper.GetHttpHandler(RequestContext requestContext) +33 
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +11507752 
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 
System.Web .HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270 




-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
4

2 回答 2

2

你用的是什么版本的 MVC?Sitecore 6.6 仅支持 MVC3,使用 MVC4 会出错。

另外 - 您使用的是 Sitecore 提供的 Global.asax 还是标准的 MVC 之一?Sitecore 版本中不应包含任何路由信息。这是来自 6.6 MVC 实现的全局 asax 的副本:

<%@Application Language='C#' Inherits="Sitecore.Web.Application" %>
<script runat="server">
  public void Application_Start() {
  }

  public void Application_End() {
  }

  public void Application_Error(object sender, EventArgs args) {
  }

  public void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args)
  {
    string frameworkVersion = this.GetFrameworkVersion();
    if (!string.IsNullOrEmpty(frameworkVersion) && frameworkVersion.StartsWith("v4.", StringComparison.InvariantCultureIgnoreCase))
    {
      args.User = Sitecore.Context.User;
    }
  }

  string GetFrameworkVersion()
  {
    try
    {
      return System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
    }
    catch(Exception ex)
    {
      Sitecore.Diagnostics.Log.Error("Cannot get framework version", ex, this);
      return string.Empty;
    }
  }

</script>

你是如何设置 MVC 的?如果有疑问,请按照John Wests 的博客进行设置。

于 2013-06-10T14:44:17.160 回答
2

我将 Sitecore 6.6 与 MVC 4 一起使用,一切正常。我和你有同样的问题,但我评论了这一行

routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); // commented this line

在 Global.asax 中,这会有所帮助。

于 2013-07-07T14:30:54.137 回答