Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7 Not Serving Default Document

Tags:

iis-7.5

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. Everyone is running Windows 7/IIS 7.5 and ASP.NET 4.0. The application pool is configured to use Classic pipeline mode.

Default documents are enabled, and default.aspx is in the default document list.

I enabled failed request tracing, and see this in the log:

OldHandlerName="", NewHandlerName="ExtensionlessUrl-ISAPI-4.0_64bit", 
  NewHandlerModules="IsapiModule", 
  NewHandlerScriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll", NewHandlerType=""

Later on, I see that this IsapiModule is rejecting the request:

ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="404",
  HttpReason="Not Found", HttpSubStatus="0", 
  ErrorCode="The operation completed successfully. (0x0)", ConfigExceptionInfo="" 

It looks like IIS thinks the ExtensionlessUrl-ISAPI-4.0-64bit should be handling the request. When I look at that module's configuration, it shows that it should be matching path *., so I'm confused why it is matching no path.

A Google search turns up this post on the IIS.net forums from 2005. Unfortunately, no solutions are offered, just an acknowledgement of the problem.

When I update my app pool to use integrated mode, the problem goes away. Unfortunately, it has to run in Classic mode.

What can I do to get IIS to server our default documents again?

like image 376
Aaron Jensen Avatar asked Aug 04 '11 21:08

Aaron Jensen


People also ask

How do I enable default files in IIS?

Right-click the Web site, virtual folder, or folder whose default document settings you want to configure, and then click Properties. Click the Documents tab. Click to select the Enable Default Document check box. This turns on default document handling for the Web site, virtual folder, or folder that you selected.

How do I set a default document?

In the Home pane, double-click Default Document. In the Add Default Document dialog box, type the name of the default document that you want to add in the Name box, and then click OK.


4 Answers

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>
like image 71
Aaron Jensen Avatar answered Sep 19 '22 22:09

Aaron Jensen


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

like image 33
Tom Avatar answered Sep 18 '22 22:09

Tom


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!

like image 34
R. Hoek Avatar answered Sep 22 '22 22:09

R. Hoek


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>
like image 27
General Soriano Avatar answered Sep 21 '22 22:09

General Soriano