DefaultDoc and IIS Master Properties

We recently was asked the following question:

I am sort of new to editing the metabase in IIS 6.0, I am currently experiencing an issue with my default documents. I have added two files (index.html,

index.php) to the defaultdoc attribute by selecting the properties of the Default WebSite and selecting the "Documents TAB" and adding the two additional files there. When I review the "DefaultDoc" values in the metabase I can see the additional files listed. The problem is that when new website are created throught the Microsoft Provisioning Framework the two additional files are not listed in the "Documents TAB" of the newly provisioned web site. However, if I manually create the websites then all of the default documents are listed correctly.

After doing some research I found that I had to set the "EnableDefaultDoc" flag to "True". Here is where my problem trully exists. I am unsure if the value is set to true or not. I can see the various locations where the "EnableDefaultDoc" flag is located in the IIS metabase but due to lack of experience can not trully determine if it is set to true or not. Please help!

:) I really need to ensure that the "EnableDefaultDoc" Flag is set to true for ALL websites created. Thanks for your continued assistance.

Understanding Master Properties in IIS

The fist concept that must be certainly understood is the hierachy that exists in IIS configuration, metabase.xml.  The metabase is built upon the concept of x.509 and basically starts with a parent, called “/” and then subsequently goes down from there.  The next node is /LM which stands for Local Machine, mostly of which doesn’t concern the typical administrator.  The nodes that typically come into play for IT professionals is the /W3SVC, /MSFTPSVC, or other nodes that control properties important for Exchange users (mail, nntp, etc.).

For purpose of this writing, I will stick with W3SVC.  In your case, you describe the key & properties that pertain to the /LM/W3SVC/1/ROOT path in the metabase and hence doesn’t indicate settings that affect other sites (or more importantly, future created websites.)

The only means to move settings from one key level to a child level is through the use of inheritence.  This means that settings that apply to Default Web Site (W3SVC/1) do not have an effect on other sites.  In order to affect all sites, you will need to set properties at the master properties level (/LM/W3SVC.)

This is done using either the IIS Manager (IIS 6) at the Web Sites folder level, or by right-clicking on the Server in the Internet Information Services Manager (IIS 5.x and below.)  You can also do this by using the command-line utility adsutil.vbs located at \inetpub\adminscripts directory.

cscript adsutil.vbs set w3svc/{property name} [value]

Understanding the DefaultDoc metabase property

The DefaultDoc property can uniquely be defined at the following nodes (aka keys):

  • Master Properties
  • Web Sites
  • Virtual Directories
  • Directories

Thus, inheritance plays a significant role when dealing with this property and on all IIS installations to date the values are set to the following (in order):

  • default.htm
  • default.asp
  • index.htm
  • default.aspx

The above setting will be the setting for the DefaultDoc for every newly created website on IIS unless this property is overriden (only capable through command-line or script.)

In your case, you are editing the location for the Default Web Site thus only impacting child nodes such as any virtual directories (current and future created) or directories.  The correct location to make this modification is at the Master Properties level hence affecting all sites including new ones.  You can edit the master properties using the following command line prompt:

cscript adsutil.vbs set w3svc/DefaultDoc “index.html, index.php”

EnableDefaultDoc Property

The EnableDefaultDoc property doesn’t have any impact on the DefaultDoc but instead instructs IIS’s core server to “look for” documents when they are not included in the request.  This is often noted or termed a courtesy redirect.  If a user requests www.microsoft.com but does not indicate a file, IIS will use the DefaultDoc metabase property list (multi-sz) in order to search for the file in the website’s path. 

The above will only be used when the EnableDefaultDoc property is set to to non-zero or true if using ADSI or WMI.  The default value that is inherited is true.

Conclusion

In short, if you make a slight adjustment you should be able to get this to work.  Their is a lot of documentation on this topic, but the one I will direct you too is the following webcast to understand how the metabase is built -

The Ins and Outs of the IIS 6.0 Metabase

~Chris

 

No Comments