IIS 7 Not Serving Default Document

前端 未结 6 1999
盖世英雄少女心
盖世英雄少女心 2020-12-08 16:06

We have a problem occuring on some of our developer workstations: when visiting a URL without a filename (e.g. http://localhost/), IIS 7 returns a 404 error

相关标签:
6条回答
  • 2020-12-08 16:14

    Adding the DefaultDocument component to IIS in add/remove windows features and then inserting the name of my default script ( index.php) worked for me.

    0 讨论(0)
  • 2020-12-08 16:17

    It looks like Microsoft released an update that enables the ExtensionlessURL HTTP handler to work with extensionless URLs. Unfortunately, this breaks certain other handlers. In my case, the DefaultDocument handler under classic app pools. The solution is to remove the ExtensionlessURL handlers in our application's web.config:

    <system.webServer>
      <handlers>
        <remove name="ExtensionlessUrl-ISAPI-4.0_32bit" />
        <remove name="ExtensionlessUrl-ISAPI-4.0_64bit" />
        <remove name="ExtensionlessUrl-Integrated-4.0" />
      </handlers>
    </system.webServer>
    
    0 讨论(0)
  • 2020-12-08 16:19

    Changing the StaticFile order helped to fix the issue, when setting default document to a web site application in IIS, while the root website also had another default document.

    0 讨论(0)
  • 2020-12-08 16:28

    I solved the problem with putting the "StaticFile" handler in HandlerMapping in front of "ExtensionlessUrlHandler-*"

    0 讨论(0)
  • 2020-12-08 16:28

    I use the following rule in web.config URL Redirect as workaround to solve this:

     <system.webServer>
        <rewrite>
          <rules>
            <rule name="Default document rewrite" stopProcessing="true">
              <match url="^(.+/)?$" />
              <action type="Redirect" url="https://{HTTP_HOST}/default.aspx" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    
    0 讨论(0)
  • 2020-12-08 16:31

    I noticed when removing the managed .NET framework (4.0) from the application pool, it fixed the problem for me too!

    We don't use .NET at all in our IIS environment!

    0 讨论(0)
提交回复
热议问题