【问题标题】:Unable to pass static file through ASP.NET pipeline无法通过 ASP.NET 管道传递静态文件
【发布时间】:2017-02-18 18:53:21
【问题描述】:

我有一个 ASP.NET Web 应用程序 (Sitecore),我应该通过 ASP.NET 处理以 .html 结尾的路由。通常,正如我所读到的,只需在 web.config 中的 /Configuration/system.WebServer/modules 中添加 validateIntegratedModeConfiguration="true" 就足够了。

但是,我没有看到这种行为。

尝试“test.html”会给我默认的 IIS 404 页面,而应该运行的代码却没有。

应用程序池已处于集成模式,属性 validateIntegratedModeConfiguration 已设置为 true。 我在这里错过了什么?

【问题讨论】:

  • 你是如何处理你的路由的?您是否正在修补 Sitecore 管道?您能否发布一些示例代码。这可能是因为html 不是Allowed Extension in config
  • “配置中允许的扩展”让我在 showconfig.aspx 的输出中进行搜索,并在 PreProcessRequest 管道中找到了相关的处理器。我将 html 添加到允许的列表中并且它有效。如果您将您的评论变成答案,我会接受它:)

标签: asp.net sitecore http-status-code-404 iis-8


【解决方案1】:

如果您的路线已使用 Sitecore 管道注册,则您需要在 Allowed extensions 列表中包含 html。像下面一样修补配置以包含您需要处理的任何扩展:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
      <preprocessRequest>
        <processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
          <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, html</param>
        </processor>
      </preprocessRequest>      
    </pipelines>    
  </sitecore>
</configuration>

【讨论】:

    猜你喜欢
    • 2011-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-14
    相关资源
    最近更新 更多