2017年3月21日 星期二

iis7 HTTP 錯誤 404.0 - Not Found

HTTP Error 404.0 - Not Found in MVC  (請參考內文的 web.config)

若IIS 找不到 aspx 檔, 出現錯誤訊息:
HTTP 錯誤 404.0 - Not Found
您尋找的資源已移除、名稱已變更,或暫時無法使用。
---

要改成:



  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
      <modules runAllManagedModulesForAllRequests="true" >
          <remove name="UrlRoutingModule"/>
          <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </modules>
      <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
          <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </handlers>
  </system.webServer>

沒有留言:

張貼留言