无法通过 ASP.NET 管道传递静态文件

Unable to pass static file through ASP.NET pipeline

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

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

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

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

如果您的路由是使用 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>