5

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?

9
  • Did you try reset IIS after you reset your settings? May 11, 2015 at 12:05
  • 2
    have you got any routing set up?
    – Ewan
    May 11, 2015 at 12:07
  • 1
    Are there any special modules/handlers installed?
    – haim770
    May 11, 2015 at 12:10
  • Maybe a permission issue? Allowed/prohibited extensions issue? ASP.NET overruling your setting? May 11, 2015 at 12:12
  • Yes - did an IIs Reset. No Routing set up - an old URL rewrite module is installed with one rule (no related).
    – Allan
    May 11, 2015 at 12:16

4 Answers 4

3
+100
  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.
1
  • If you want use index.html as a default page. you need to click on iis website and click on default document, add index.html as your default document. May 11, 2015 at 13:49
0

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

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

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.

1
  • As you can see from the config examples I posted in the original question <defaultDocument enabled="true"> and <add value="index.html" />
    – Allan
    May 12, 2015 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.