Windows – Default document not working under IIS 5.1

default-documentiiswindows

I have followed all the steps in this posting to setup the IIS. But when I got to the http://domainname/ by itself, it does not load the 'Default Document'. I get:

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:

HTTP 404 – File not found
Internet Information Services

However, if I put the full name, it seems to load just fine (ex: http://domainname/Default.htm)

I have verified that the Default.htm file is added in the 'Documents' tab under the 'Default Web Site Properties' and the 'Enable Default Document' is checked.

The default location is set to: C:\Inetpub\wwwroot

The contents of Default.htm:

<html>
 <head>
  <title>Test Page</title>
 </head>
 Hi<br>
 <a href="http://pep.si/cZwVJi">Cure for Giant Auxonal Neuropathy</a>
</html>

Here is the log, but I'm not sure what to make of it:

Software: Microsoft Internet Information Services 5.1
Version: 1.0
Date: 2010-08-26 12:10:59
Fields: time c-ip cs-method cs-uri-stem sc-status
12:10:59 X.X.X.X GET / 404
12:11:19 X.X.X.X GET / 404
12:14:11 X.X.X.X GET / 404
12:15:10 X.X.X.X GET / 404
13:50:36 Y.Y.Y.Y GET / 404
13:50:45 Y.Y.Y.Y GET /Default.htm 200
13:50:58 Y.Y.Y.Y GET / 404

where X.X.X.X is the local IP and Y.Y.Y.Y is IP to the world

Is there anything else that I could be missing?

Update: Looks like I can get it to work if the 'Home Directory' is set to something other than C:\Inetpub\wwwroot. I changed it to C:\Inetpub\wwwroot\Test and moved the files there, then went to http://domainname and it worked. Does anyone know why the default path doesn't work?

Best Answer

The server knows that it should serve the default document when the browser request comes in to the server name or the ip address. It doesn't know that it should serve the default document when the browser request comes in to any other names, whether those names resolve to the ip address or not.

When you specify the URL and the document you're specifically telling the server to retrieve a specific file from whatever web site is running on the ip address that domainname resolves to. It's like retrieving a file from the file system by specifying the absolute path to that file. You could put any file there and retrieve it regardless of whether it's in the documents list or not just by specifying the filename (the absolute path).

You need to add a host header to the web site for domainname so that it knows it should respond to requests for http://domainname.


Of course I could be completely wrong. I don't work with IIS that much.