mvc的IIS 配置问题 runAllManagedModulesForAllRequests 与 HtmlFileHandler

runAllManagedModulesForAllRequests 一般设置为false,当为true时所有的资源将进入mvc处理,无疑会给服务器加大压力。
解决办法是时使用HtmlFileHandler
HtmlFileHandler 的 path 可以为“*.html” 表示所有的html后缀都将进入mvc处理
 
<configuration>
    <system.webServer>
  <!---->
      <modules runAllManagedModulesForAllRequests="false"/>
  <!--请求 允许某个后缀名请求进入处理 避免使用runAllManagedModulesForAllRequests="true" -->
      <add name="HtmlFileHandler" path="page.html" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </system.webServer> 
</configuration>
 
 
posted @ 2016-11-07 13:44  海棠厅畔  阅读(826)  评论(0编辑  收藏  举报