【问题标题】:500 errors when loading .axd files in Sitecore CMS在 Sitecore CMS 中加载 .axd 文件时出现 500 错误
【发布时间】:2013-06-06 06:16:50
【问题描述】:

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

【问题讨论】:

    标签: asp.net-mvc sitecore


    【解决方案1】:

    您使用的是哪个版本的 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 进行设置。

    【讨论】:

    • 我正在使用 MVC 3。事实上,“routes.registerRoute()”是我的 Global.asax 文件的一部分。我不确定这行在文件中有多长,但是当我删除那行时,问题就消失了。谢谢!
    【解决方案2】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-04
      • 2017-04-04
      • 2020-03-24
      相关资源
      最近更新 更多