5
votes

I have a website with the default settings for default document on IIS 8.5 Windows 2012 R2.

<system.webServer>
  <defaultDocument enabled="true">
    <files>
      <add value="Default.aspx" />
      <add value="Default.htm" />
      <add value="Default.asp" />
      <add value="index.htm" />
      <add value="index.html" />
      <add value="iisstart.htm" />
    </files>
  </defaultDocument>
</system.webServer>

When I browse to a URL without a file name (mysite.com/Content/) IIS will only try default.aspx and no other files in the list (index.html). IIS tries to load default.aspx and I get a 404. The strange thing is there is no default.aspx file in that directory and index.html does exist. If I browse directly to index.html the page displays properly. According to the Microsoft documentation on default document it should try the next file in the list until it finds one that exists.

I explicitly added a web.config file to the sub directory with

<defaultDocument enabled="true">
  <files>
      <clear />
       <add value="index.html" />
   </files>
 </defaultDocument>

and IIS is still trying to use default.aspx. Has anyone encountered this before? Do you have any suggestions as to why this is not working as documented?

4
Did you try reset IIS after you reset your settings?Amnesh Goel
have you got any routing set up?Ewan
Are there any special modules/handlers installed?haim770
Maybe a permission issue? Allowed/prohibited extensions issue? ASP.NET overruling your setting?Ondrej Tucny
Yes - did an IIs Reset. No Routing set up - an old URL rewrite module is installed with one rule (no related).Allan

4 Answers

3
votes
  1. Try removing/disabling the old URL rewrite module? (temporarily)
  2. If you are requiring authentication, make sure the login page exists.

(other suggestions copied from above, which I have included, in case someone else reads this question)

  1. Check for any routing in the source-code.
  2. Check any special modules or handlers, which might cause redirects or intercept calls.
0
votes

One method for making default document directive to work is: Go to IIS/Application Pools Change the ‘Managed Pipeline Mode’ to Classic mode instead of Integrated Mode. This worked for me.

-1
votes

If you disable default documents but have enabled directory browsing, IIS returns a directory listing when a request for the root directory arrives from a browser. If you disable both default documents and directory browsing, IIS sends an "HTTP 404 File Does Not Exist" error to the browser.

So please enable default documents option in IIS and reset IIS.

-1
votes

If you want use index.html as a default page. you need to click on iis default website after that you can click on default document. Now! you can add index as default page.