2023年11月9日 星期四

.NET MVC 佈署到IIS後發生錯誤 HTTP Error 403.14 - Forbidden

 參考自StackOverFlow文章

Don't use runAllManagedModulesForAllRequests. You want to let IIS handle resources such as images.

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

Instead add the MVC routing module

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  </modules>
</system.webServer>