次の方法で共有


Accessing the IIS ADSI Schema Management Objects

The IIS ADSI Schema defines the group of objects that can be stored in the metabase. The Schema Management Objects are used to represent the IIS ADSI Schema. The IIS ADSI Schema does not represent the ADSI object hierarchy, but can be thought of as an information store.

The Schema container object is used to attach a set of object definitions to the IIS namespace tree. Typically, each instance of a namespace will have its own schema. ADSI represents this by placing a Schema container as a child of the namespace root.

For example, the IIS ADSI Schema contains definitions for classes, such as IIsWebServer (ADSI). At the IIsWebServer (ADSI) object level, the IIS ADSI Schema defines which properties can be set for that object; for example, the ServerBindings property. The IIS ADSI Schema also contains definitions for each property defined for the object, such as the property's data type.

Schema Management

The Schema Management Objects support interfaces that are used to browse and modify the schema of a namespace. By using the Schema Management Objects together, you can create a new property that can be set at a virtual directory. For example, if you have a custom ISAPI extension, and you want to be able to configure it at each virtual directory in your Web site, you can define new properties that can be set at the virtual directory level. Editing the IIS ADSI Schema requires write access to the Schema container and its contents. By default, this capability is limited to members of the Administrators group on the local machine.

The Schema Management Objects are:

  • Schema: The container object that contains a given schema.

  • Class: An object that defines a schema object class.

  • Property: An object that describes a property.

The Schema container object contains the IIS ADSI Schema Class object.

The IIS ADSI Schema Class object defines a class of objects that can be created in the IIS namespace, such as IIsWebServer (ADSI) and IIsComputer (ADSI). The Class object supports the mandatory interface IADs, as well as the IADsClass COM interface. A given IIS ADSI Schema Class object contains a list of the property names it contains in the OptionalProperties list.

Note

Although some ADSI providers require class objects to maintain a MandatoryProperties list, the IIS ADSI provider does not require mandatory properties. Therefore, all properties are optional, and you must provide any additional required properties by adding them to the OptionalProperties list.

You can update the IIS ADSI Schema using a script or program. The schema is stored in the Schema, Class, and Property objects in the IIS metabase. You can write simple scripts that call ADSI methods to extend the IIS ADSI Schema. For a look at some sample code, see How to Extend the IIS ADSI Schema.

Note

It is also possible to use other programming languages that support COM and Automation, such as C, C++, or Java, to write scripts or programs to extend the IIS ADSI Schema.

Using Schema Interfaces

The IIS ADSI Schema is implemented as a group of objects stored in the metabase; this makes it possible to manipulate the Schema using the standard ADSI object and container interfaces, IADs and IADsContainer. When extending the IIS ADSI Schema, developers should use the IADs and IADsContainer interfaces.

The Schema container is located at IIS://LocalHost/Schema. To access the IIS ADSI Schema, you can implement a script or ASP page to point to the IIS ADSI Schema location. To set the path, you might use the following code:

<% 
dim root 
dim schemaObj 
set SchemaObj = GetObject ("IIS://" & MachineName & "/Schema") 
... 
%> 

About IIS Classes

The Class object is the unit of storage in the IIS metabase. Classes define Class objects. The type of the Class defines the type of the new object. For example, to create a new property, the class type must be of type Property.

The Class object lists the following information:

  • The name of the class.

  • The object identifier for the class.

  • The globally unique identifier (GUID) for the class.

  • The properties (configuration parameters) that an instance of the class must have.

  • The additional attributes that an instance of the class can (optionally) have.

  • Which existing classes can create instances of this class.

Programs and scripts that extend the IIS ADSI Schema should apply updates in the following order

  1. Add new classes.

  2. Add new properties.

  3. Add properties to classes.