Поделиться через


Metabase Structure

In IIS, the metabase stores information about the configuration of IIS. A developer can create Web sites, virtual directories, change performance and security settings, install ISAPI DLLs, and make choices about what information is written to the IIS log files, and all of that information is stored in the metabase.

Overview

Configuration information about IIS follows a set of rules, which determines things like where a property can be set. For example, the GreetingMessage property, which only applies to the FTP service or an FTP site, cannot be set on a Web service or Web site. Such rules are specified in the metabase schema. IIS follows the rules in the schema when building the configuration in the metabase.

The schema never changes in the normal course of IIS operation. Developers have the option to use ADSI to extend the schema, but it is not recommended. Data that is not related to IIS configuration should be kept outside of the metabase.

The metabase changes every time IIS is configured.

When you start IIS, the schema and the configuration data that are contained in the metabase are read by the storage layer of IIS and loaded to the in-memory metabase from which IIS operates. The internal metabase implementation is in Unicode format in order to support international and non-ASCII characters.

IIS 4.0, IIS 5.0: The IIS metabase and schema are stored as one entity in a binary-formatted file called Metabase.bin. IIS can only retrieve data from the metabase and display it using the code page of the server. Characters of a different code page display as garbage unless elaborate text conversion algorithms are used in an IIS application.

IIS 5.1: The IIS metabase and schema are stored as one entity in a binary-formatted file called Metabase.bin. IIS can retrieve data from the metabase and display it using the code page specified by the IIS application. The code page used to store the data must be identical to the code page that is used to display the data.

IIS 6.0: The IIS metabase and schema are stored in separate XML-formatted files called Metabase.xml and MBSchema.xml. To support international and non-ASCII characters, the MetaBase.xml file is encoded in UTF-8 text format. IIS can retrieve data from the metabase and display it using the code page that is specified by the IIS application. The code page that is used to store the data must be identical to the code page that is used to display the data.

Internal Structure

The IIS metabase has a hierarchical structure. Configuration data is stored in nodes (or keys) that are associated with IIS elements. The keys are organized in a path structure that is similar to the Windows registry, or to a file system. Keys are identified by their path within the metabase. For example, the path /LM specifies the local machine (computer) key, and the path /LM/W3SVC/3 specifies the key for the third Web site (virtual server).

Data entries can be assigned to each key, and each data entry has a unique identifier in the metabase. For example, ServerState is a property representing data that specifies the state of a virtual server, and, when located at the key having the path /LM/W3SVC/1/ServerState, specifies data that describes the state of the first virtual Web server on the local machine. The data that is contained in /LM/W3SVC/1/ServerState might be different than the data contained in /LM/W3SVC/2/ServerState, as the state can differ for each virtual server.

For each FTP or Web server, the root virtual directory is given the name ROOT. For example, the path /LM/W3SVC/1/ROOT/Scripts/Script1.asp refers to the key that is associated with an ASP page in the virtual directory Scripts under the first virtual Web server on the local machine.

The following illustration shows the hierarchy of nodes in the metabase. Shaded nodes are not available in IIS 5.1 or earlier versions. Use this table to determine where inheritance might occur. A similar diagram that uses the admin objects names that represent the metabase nodes is available in the IIS Admin Object Hierarchy topic.

IIS Metabase Structure

Metabase Concepts

The following table describes concepts that help to understand the structure of the metabase.

Term

Description

Node or Key

A hierarchical container in the IIS metabase. Each node enables a specific set of properties to be configured at that location or path. For example, at the Web service node, identified by the IIsWebService IIS Glossary at the /LM/WSVC path in the metabase, certain properties like AppRoot can be set that affect the IIS Web service. A node is a child of another node if its path includes the path of the parent (for example, /LM/WSVC/1 is a child node of /LM/WSVC).

Path or Location

A path in the metabase uniquely identifies the hierarchical position of a node. For example /LM (local machine) is the path of the IIsComputer admin object, of which there can be only one. However, the IIsWebVirtualDir admin object can exist at several paths in the metabase, such as /LM/W3SVC/1/ROOT, /LM/W3SVC/2/ROOT, and /LM/W3SVC/2/ROOT/MyVDir.

IIS 6.0: Each key in the metabase contains a Location attribute that specifies the path.

Property or Custom Property

A property or custom property defines values that are used to configure IIS. Properties contain attributes, and some properties, such as AccessFlags, also contain flags. Properties are contained by nodes in the metabase. Custom properties are not defined in the schema, but are configurable in the metabase as IIsCustom and contained in the IISConfigObject parent node.

Attributes

Metabase properties contain several attributes that describe some characteristics of the property, such as the INHERIT attribute.

IIS 6.0: Not to be confused with XML attributes set in the Metabase.xml file, such as the Location attribute.

Flags

A flag is a particular bit within the DWORD value of a property that contains flags. Each flag within a property is used to configure particular functionality of the property, such as read or write access. The sum of the flag values for a property becomes the sum of the value attribute for that property.

Collections

The structure of the metabase schema is organized using containers called "collections."

Inheritance

To keep the size of the metabase manageable, IIS allows inheritance of properties from parent node to child node. Not all properties are inheritable properties. If an inheritable property is explicitly set at a child node, the explicit value overrides the inherited value.

It is recommended that you do not rely heavily on inheritance. Each inherited property requires extra processing time to allow its value to be obtained from the parent node, and therefore negatively impacts performance.