在Sitecore CMS中加载.axd文件时出现500错误

时间:2013-06-10 14:38:41

标签: asp.net-mvc sitecore

我正在运行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

2 个答案:

答案 0 :(得分: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 blog进行设置。

答案 1 :(得分:2)

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

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

,这有帮助。