2016-10-10 37 views
2

我有一个ASP.NET Web应用程序(Sitecore),我应该处理通过ASP.NET以.html结尾的路由。通常,正如我读过的,只需在web.config中添加validateIntegratedModeConfiguration="true",/Configuration/system.WebServer/modules即可。无法通过ASP.NET管道传递静态文件

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

尝试“test.html”为我提供了默认的IIS 404页面,而且应该运行的代码没有。

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

+0

你是如何处理你的路由?您是否在修补Sitecore管道?你可以发布一些示例代码。这可能是由于'html'不是[配置中允许的扩展名](http://stackoverflow.com/a/39471240/661447)。 – jammykam

+1

“允许的扩展在配置”让我搜索showconfig.aspx的输出,并在那里我找到了PreProcessRequest管道中的相关处理器。我将html添加到允许的列表中,并且工作正常。如果你把你的评论变成答案,我会接受它:) – Yiangos

回答

2

如果您的路线已经使用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>