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>
 
 
原文地址:https://www.cnblogs.com/mingtianct/p/6038513.html