다음을 통해 공유


Configuring the Metabase

Applies To: Windows Server 2003, Windows Server 2003 with SP1

The IIS metabase is a plaintext XML file containing most IIS configuration values. The metabase can be configured manually, by using IIS Manager or a text editor, or programmatically, using the IIS WMI and ADSI providers. Deciding the method you use to configure the metabase depends on the task you want to accomplish. For a one-time, one-step configuration task, editing the metabase file directly in a text editor might be easiest; for repetitive tasks that require a number of steps, a programmatic approach is most efficient. Another important aspect of configuring the metabase is knowing how to back up and restore the metabase if changes result in an error.

IIS includes several methods for changing values in the metabase. As shown in Figure 4,2, you can set or view metabase values programmatically by using any of the following resources:

  • IIS Manager. The user interface (UI) that you can use to update the in-memory metabase. This is the safest way to update the metabase. However, it does not expose all available metabase properties.

  • IIS ADSI provider. A set of scripting interfaces that you can run from a script.

  • IIS WMI provider. A set of scripting interfaces that you can run from a script.

  • Admin Base Objects (ABOs). A set of binary COM interfaces.

All configuration settings are written to the metabase through ABOs, as illustrated in Figure 4.2.

Art Image

About the IIS ABOs

As shown in Figure 4.2, the ABOs are central to updating the in-memory metabase. An ABO is a set of binary COM objects that are used to write IIS configuration values that are stored in the IIS metabase. Each object has properties, and each property is stored in the metabase. You can manipulate IIS configuration by using ABOs to add new virtual directories, new Web sites, and so forth.

IIS Manager and the other resources in the illustration that are used to update the in-memory metabase write directly to the ABOs. The ABOs then write the changes to the in-memory metabase. You can also access ABOs directly by using C or Microsoft® Visual C++® development system, Microsoft® Visual Basic® development system, Delphi, or any COM-compliant language to programmatically update the in-memory metabase. You cannot use scripting language code to programmatically update the in-memory metabase.

Metabase Storage Layer

The in-memory metabase is periodically written to disk through the metabase storage layer. The metabase storage layer is the part of IIS that reads the metabase files into the in-memory metabase and also writes the in-memory metabase to the metabase files. The storage layer writes the in-memory metabase directly to the metabase files when a write-to-disk event occurs or when IIS is shut down.

Important

You cannot edit the MBSchema.xml file directly by using edit-while-running. Changes to MBSchema.xml must be made programmatically by using ADSI.

Adding Comments to the Metabase

A metabase comment must be stored in the in-memory metabase in the correct XML format and associated with a particular node within the metabase, so the context of the comment is preserved during subsequent writes of the metabase to disk. Put node-specific comments right above the node. If you delete the node, the comments about the node are deleted as well.

When loading the metabase, the configuration system loads comments as a generic property into the metabase, along with other metabase data. Any comments found at the bottom of the file (below all nodes) will always be preserved at the bottom of the file.

Comments are added in the following format:

<!-- your comment goes here -->

The following is a list of rules concerning metabase comments:

  • Comments that are added above the MBProperty node are not picked up by edit-while-running.

  • Comments that are added between the MBProperty node and the IIS_Globalnode cause an error file to be created.

  • Comments that are added between IIS_Global and IIS_ROOT are picked up by edit-while-running.

  • Adding comments between start and end XML tags results in an error file and the in-memory metabase being flushed to disk.