An Overview of the IIS Metabase
With the introduction of IIS 4, came the introduction of the metabase. IIS configuration information was no longer stored in the Registry, but in the new metabase structure. Some IIS configuration settings however still remained stored in the Registry, under the following keys:
- HKLMSOFTWAREMicrosoftInetMgrParameters
- HKLMSYSTEMCurrentControlSetServicesInetInfoParameters
- HKLMSYSTEMCurrentControlSetServicesASPParameters
- HKLMSYSTEMCurrentControlSetServicesHttpParametersLogBufferSize
- HKLMSYSTEMCurrentControlSetServicesW3SVCParameters
- HKLMSYSTEMCurrentControlSetServicesMSFTPSVCParameters
In IIS 4, separating the majority of IIS configuration settings into the metabase; speeded up access to the information. The issue with the metabase in IIS 4 and IIS 5 was that it was a binary file. This meant that it could not directly be modified by administrators.
With IIS 6 came the new improved metabase. The most significant enhancement to the metabase in IIS 6 is that the binary format has been discarded. In IIS 6, the metabase is formatted as a plain text file using the Extensible Markup Language (XML). This means that you can edit the metabase using a text editor such as Notepad. In addition, whether changes are made manually or programmatically to the metabase, you no longer need to stop and restart IIS. You can use the Windows Management Instrumentation (WMI) or the Active Directory Services Interface (ADSI) to make changes to the metabase. You can also copy configuration settings from one IIS machine to another IIS machine. You can copy a particular website or virtual directory, or you can copy all IIS configurations.
The new IIS 6 metabase history feature tracks changes to the metabase, and then automatically saves backups of the metabase. This enables you to revert to a previously saved version when you experience problems with current configuration settings.
The IIS 6 version of the metabase no longer consists of only one metabase file (metabase.bin) but two metabase files, namely:
- MetaBase.xml: This XML formatted file holds the IIS configuration data.
- MBSchema.xml: This XML formatted file holds the schema information for the MetaBase.xml file.
Both MetaBase.xml and MBSchema.xml are located under WindowsSystem32Inetsrv. Access to the files is controlled by:
- Administrators, Full Control; and SYSTEM,Full Control
Management of the metabase functions lies with the IIS Admin service, inetinfo.exe. The responsibilities of inetinfo.exe are:
- Metabase Storage Layer and Admin Base Objects: The Metabase Storage Layer formats the MetaBase.xml andMBSchema.xml files from disk and the converts them from XML to binary format when a Windows Server 2003 IIS machine boots. Admin Base Objects (ABO)is used to write the metabase to the IIS file cache.
- Tracks any changes which are made to the metabase files.
- Responsible for the metabase history feature. When changes are made to the metabase, the metabase history feature automatically saves backup copies of the metabase.
- Responsible for the synchronization of the in-memoryversion and on disk version of the metabase files.
The following process occurs when you stop IIS via the IIS Manager:
- IIS first checks the in-memorymetabase to verify that all recent changes are written to disk.
- IIS stops if all recently madechanges have been written to disk.
- The in-memory metabase overwritesthe MetaBase.xml and MBSchema.xml files on disk when all recent changes have not yet been written to disk.A new history file is saved to disk for both files. Only after this, doesIIS stop.
The following process occurs when you restart IIS via the IIS Manager:
- The Metabase Storage Layer readsthe MetaBase.xml and MBSchema.xml files on disk.
- It converts both files to the binaryformat.
- Admin Base Objects (ABO) is usedto write the metabase to the IIS file cache.
- ABO also creates the in-memorymetabase nodes.
IIS automatically generates history files which are located in the WindowsSystem32InetsrvHistory folder. The history files are basically versioned copies of the metabase. A history file is generated when the flowing events occur:
- Configuration changes are made after the in-memory metabase was already flushed to disk.
- IIS flushes the in-memory metabase to disk.
A history file consists of the following components:
- Copy of the in-memory MetaBase.xmlnode
- Copy of the in-memory MBSchema.xmlnode
A history file has a major version number and a minor version number. The major version number is incremented by one when IIS flushes the in-memory metabase to disk. IIS flushes the in-memory metabase to disk when the following events occurs, thereby creating the major version number:
- IIS is stopped using the IIS Manager or the net stop iisadmin command; or IIS is restarted using the IIS Manager.
- IIS configuration changes are saved to disk using the All Tasks | Save Configuration To Disk option.
- IIS automatically flushes pending in-memory metabase changes to disk.
The minor version number is incremented by one when changes have been manually made to the metabase files on disk. The minor version number is reset to zero when the MetaBase.xml and MBSchema.xml files are flushed to disk. This occurs when the major version number is incremented by one.
The history files for the two types of metabase files are called:
- Metabase_majorversion_minorversion.xml,for the MetaBase.xml file
- MBSchema_majorversion_minorversion.xml,for the MBSchema.xml file
Metabase Flushing
Metabase flushing is the terminology utilized to refer to the events when IIS overwrites the MetaBase.xml and MBSchema.xml files located in the System32Inetsrv folder with the in-memory metabase. This results in new history files being created in the System32InstsrvHistory folder. IIS flushes the in-memory metabase when the events listed below occur:
- IIS is stopped using the IIS Manager or the net stop iisadmin command; or IIS is restarted using the IIS Manager.
- IIS configuration changes are saved to disk using the All Tasks | Save Configuration To Disk option.
- IIS automatically flushes pending in-memory metabase changes to disk.
- IIS automatically restarts when the IIS Admin service is terminated in any abnormal manner. This would only occur if the Automatic Restart feature of IIS is enabled.
- IIS configuration is backed up via the IIS Manager or from the command line.
- Iiscnfg /save is utilized from the command line. Iiscnfg.vbs is a WMI script. The IIS management tasks that can be performed using Iiscnfg.vbs are:
- Save IIS configuration to disk.
- Copy IIS configuragtion.
- Export and import IIS configuration.
How to edit the metabase
With IIS 6, you can use any of the following approaches to edit the metabase:
- Stop IIS, and then manually edit the metabase. Stopping IIS would result in no users being able to accessthe IIS server.
- Enable the new Direct MetabaseEdit feature, and then manually edit the metabase. When Direct MetabaseEdit is enabled, changes can be made to the metabase without disconnectingusers from the IIS server.
When the Direct Metabase Edit feature is enabled, you can use a text editor such as Notepad to make changes to the MetaBase.xml file. You can also programmatically change the MetaBase.xml file using scripts. When you save the changes you make to the MetaBase.xml file, IIS copies the MetaBase.xml file to the in-memory metabase. There is though a slight time lapse between when the actual changes are saved, and when it is copied to the in-memory metabase. This is due to the response time of the Windows file change notification service.
To enable the Direct Metabase Edit feature using IIS Manager,
- Open IIS Manager.
- Right-click the IIS server node in the console tree, and select Properties from the shortcut menu.
- When the Properties dialogbox opens, select the Enable Direct Metabase Edit checkbox.
- Click OK.
To enable the Direct Metabase Edit feature using the command line,
- Open a command prompt on the IIS server.
- Enter iisreset /stop to stop IIS running on the server.
- Use a text editor to open the MetaBase.xmlfile.
- To enable the Direct Metabase Edit feature, change the value of the EnableEditWhileRunning property to 1.
- Save this change to the MetaBase.xmlfile.
- Enter iisreset /start to restart IIS.
Before making changes to the metabase, whether it is manually or programmatically; it is recommended to first back up the metabase.
How to back up the metabase
IIS creates a metabase backup when it is initially installed, in the System32InetsrvMetaBack folder. IIS also creates history files as backups of the metabase. You can however manually backup the metabase as well.
To back up the metabase using IIS Manager,
- Right-click the IIS server whose metabase you want to back up, select All Tasks from the shortcut menu, and then select Backup/Restore Configuration.
- The Configuration Backup/Restoredialog box opens. The Configuration Backup/Restore dialog box displays the following information:
- The initial configuration backups created when IIS was first installed.
- All manually created backups.
- All history files.
- Click the Create Backup button to back up the metabase.
- When the Configuration Backup dialog box opens, enter a name for the backup and a password for securing the backup.
- Click OK.
- The newly created backup is now listed in the Backup list box of the Configuration Backup/Restore dialogbox.
- All backup files are in the following folder:
- Systemroot%System32 inetservMetaBack
- An .md0 file extension indicates a metabase backup file
- An .sc0 file extension indicates a metabase schema backup file
- Systemroot%System32 inetservMetaBack
An Overview of the IIS Metabase
With the introduction of IIS 4, came the introduction of the metabase. IIS configuration information was no longer stored in the Registry, but in the new metabase structure. Some IIS configuration settings however still remained stored in the Registry, under the following keys:
- HKLMSOFTWAREMicrosoftInetMgrParameters.
- HKLMSYSTEMCurrentControlSetServicesInetInfoParameters.
- HKLMSYSTEMCurrentControlSetServicesASPParameters.
- HKLMSYSTEMCurrentControlSetServicesHttpParametersLogBufferSize.
- HKLMSYSTEMCurrentControlSetServicesW3SVCParameters.
- HKLMSYSTEMCurrentControlSetServicesMSFTPSVCParameters.
In IIS 4, separating the majority of IIS configuration settings into the metabase; speeded up access to the information. The issue with the metabase in IIS 4 and IIS 5 was that it was a binary file. This meant that it could not directly be modified by administrators.
With IIS 6 came the new improved metabase. The most significant enhancement to the metabase in IIS 6 is that the binary format has been discarded. In IIS 6, the metabase is formatted as a plain text file using the Extensible Markup Language (XML). This means that you can edit the metabase using a text editor such as Notepad. In addition, whether changes are made manually or programmatically to the metabase, you no longer need to stop and restart IIS. You can use the Windows Management Instrumentation (WMI) or the Active Directory Services Interface (ADSI) to make changes to the metabase. You can also copy configuration settings from one IIS machine to another IIS machine. You can copy a particular website or virtual directory, or you can copy all IIS configurations.
The new IIS 6 metabase history feature tracks changes to the metabase, and then automatically saves backups of the metabase. This enables you to revert to a previously saved version when you experience problems with current configuration settings.
The IIS 6 version of the metabase no longer consists of only one metabase file (metabase.bin) but two metabase files, namely:
- MetaBase.xml: This XML formattedfile holds the IIS configuration data.
- MBSchema.xml: This XML formattedfile holds the schema information for the MetaBase.xml file.
Both MetaBase.xml and MBSchema.xml are located under WindowsSystem32Inetsrv. Access to the files is controlled by:
- Administrators, Full Control; and SYSTEM,Full Control.
Management of the metabase functions lies with the IIS Admin service, inetinfo.exe. The responsibilities of inetinfo.exe are:
- Metabase Storage Layer and Admin Base Objects: The Metabase Storage Layer formats the MetaBase.xml andMBSchema.xml files from disk and the converts them from XML to binaryformat when a Windows Server 2003 IIS machine boots. Admin Base Objects (ABO)is used to write the metabase to the IIS file cache.
- Tracks any changes which are made to the metabase files.
- Responsible for the metabase history feature. When changes are made to the metabase, the metabase historyfeature automatically saves backup copies of the metabase.
- Responsible for the synchronization of the in-memoryversion and on disk version of the metabase files.
The following process occurs when you stop IIS via the IIS Manager:
- IIS first checks the in-memorymetabase to verify that all recent changes are written to disk.
- IIS stops if all recently madechanges have been written to disk.
- The in-memory metabase overwritesthe MetaBase.xml and MBSchema.xml files on disk when all recent changes have not yet been written to disk.A new history file is saved to disk for both files. Only after this, doesIIS stop.
The following process occurs when you restart IIS via the IIS Manager:
- The Metabase Storage Layer readsthe MetaBase.xml and MBSchema.xml files on disk.
- It converts both files to the binaryformat.
- Admin Base Objects (ABO) is usedto write the metabase to the IIS file cache.
- ABO also creates the in-memorymetabase nodes.
IIS automatically generates history files which are located in the WindowsSystem32InetsrvHistory folder. The history files are basically versioned copies of the metabase. A history file is generated when the flowing events occur:
- Configuration changes are madeafter the in-memory metabase was already flushed to disk.
- IIS flushes the in-memory metabaseto disk.
A history file consists of the following components:
- Copy of the in-memory MetaBase.xmlnode.
- Copy of the in-memory MBSchema.xmlnode.
A history file has a major version number and a minor version number. The major version number is incremented by one when IIS flushes the in-memory metabase to disk. IIS flushes the in-memory metabase to disk when the following events occurs, thereby creating the major version number:
- IISis stopped using the IIS Manager or the net stop iisadmin command; or IIS is restarted using the IIS Manager.
- IIS configuration changes aresaved to disk using the All Tasks | Save Configuration To Disk option.
- IIS automatically flushes pendingin-memory metabase changes to disk.
The minor version number is incremented by one when changes have been manually made to the metabase files on disk. The minor version number is reset to zero when the MetaBase.xml and MBSchema.xml files are flushed to disk. This occurs when the major version number is incremented by one.
The history files for the two types of metabase files are called:
- Metabase_majorversion_minorversion.xml,for the MetaBase.xml file.
- MBSchema_majorversion_minorversion.xml,for the MBSchema.xml file.
Metabase Flushing
Metabase flushing is the terminology utilized to refer to the events when IIS overwrites the MetaBase.xml and MBSchema.xml files located in the System32Inetsrv folder with the in-memory metabase. This results in new history files being created in the System32InstsrvHistory folder. IIS flushes the in-memory metabase when the events listed below occur:
- IISis stopped using the IIS Manager or the net stop iisadmin command; or IIS is restarted using the IIS Manager.
- IIS configuration changes aresaved to disk using the All Tasks | Save Configuration To Disk option.
- IIS automatically flushes pendingin-memory metabase changes to disk.
- IIS automatically restarts whenthe IIS Admin service is terminated in any abnormal manner. This wouldonly occur if the Automatic Restart feature of IIS is enabled.
- IIS configuration is backed up viathe IIS Manager or from the command line.
- Iiscnfg /save is utilized from thecommand line. Iiscnfg.vbs is a WMI script. The IIS management tasks thatcan be performed using Iiscnfg.vbs are:
- Save IIS configuration to disk.
- Copy IIS configuragtion
- Export and import IIS configuration
How to edit the metabase
With IIS 6, you can use any of the following approaches to edit the metabase:
- Stop IIS, and then manually editthe metabase. Stopping IIS would result in no users being able to accessthe IIS server.
- Enable the new Direct MetabaseEdit feature, and then manually edit the metabase. When Direct MetabaseEdit is enabled, changes can be made to the metabase without disconnectingusers from the IIS server.
When the Direct Metabase Edit feature is enabled, you can use a text editor such as Notepad to make changes to the MetaBase.xml file. You can also programmatically change the MetaBase.xml file using sripts. When you save the changes you make to the MetaBase.xml file, IIS copies the MetaBase.xml file to the in-memory metabase. There is though a slight time lapse between when the actual changes are saved, and when it is copied to the in-memory metabase. This is due to the response time of the Windows file change notification service.
To enable the Direct Metabase Edit feature using IIS Manager,
- Open IIS Manager.
- Right-click the IIS server node inthe console tree, and select Properties from the shortcut menu.
- When the Properties dialog boxopens, select the Enable Direct Metabase Edit checkbox.
- Click OK.
To enable the Direct Metabase Edit feature using the command line,
- Open a command prompt on the IIS server.
- Enter iisreset /stop to stop IIS running on the server.
- Use a text editor to open the MetaBase.xmlfile.
- To enable the Direct Metabase Editfeature, change the value of the EnableEditWhileRunning property to 1.
- Save this change to the MetaBase.xmlfile.
- Enter iisreset /start to restart IIS.
Before making changes to the metabase, whether it is manually or programmatically; it is recommended to first back up the metabase.
How to back up the metabase
IIS creates a metabase backup when it is initially installed, in the System32InetsrvMetaBack folder. IIS also creates history files as backups of the metabase. You can however manually backup the metabase as well.
To back up the metabase using IIS Manager,
- Right-click the IIS server whosemetabase you want to back up, select All Tasks from the shortcut menu, andthen select Backup/Restore Configuration.
- The Configuration Backup/Restoredialog box opens. The Configuration Backup/Restore dialog box displays thefollowing information:
- The initial configuration backups created when IIS was first installed.
- All manually created backups.
- All history files.
- Click the Create Backup button toback up the metabase.
- When the Configuration Backupdialog box opens, enter a name for the backup and a password for securingthe backup.
- Click OK.
- The newly created backup is nowlisted in the Backup list box of the Configuration Backup/Restore dialogbox.
- All backup files are in thefollowing folder:
- Systemroot%System32 inetservMetaBack
- An .md0 file extension indicates a metabase backup file.
- An .sc0 file extension indicates a metabase schema backup file.
- Systemroot%System32 inetservMetaBack
To restart IIS using the IIS Manager,
- Right-click the IIS server, selectAll Tasks on the shortcut menu, and then click Restart IIS.
- You can choose between thefollowing options:
- Restart IIS.
- Restart Server.
- Stop IIS.
- Start IIS.
You can use the Iisback.vbs WMI script to perform the management tasks listed below:
- Back up and restore IISconfiguration data.
- Delete IIS configuration data.
- View, or list IIS configurationdata.
How to export the metabase
You can export portions of the metabase, or the entire metabase configuration information to a file. You can basically export the configuration settings for only a particular website or virtual directory, or you can export all configuration settings. You can also through exporting, create a metabase template file to copy configuration information to multiple IIS machines. You can export metabase configuration information by using the IIS Manager, or the Iiscnfg.vbs WMI script.
To export the metabase using the IIS Manager,
- Open the IIS Manager.
- Right-click the IIS server whoseconfiguration setting you want o export, select All Tasks on the shortcutmenu, and then click Save Configuration To A File.
- When the Save Configuration To AFile dialog box opens, enter a name for the file in the File Name textbox.
- Verify that the correct locationis specified in the Path checkbox.
- Select the Encrypt ConfigurationUsing Password checkbox.
- Click OK.
How to import the metabase
You can import previously exported files to the same IIS machine, or to a different IIS machine.
To import a previously exported file to the same IIS machine,
- Open the IIS Manager.
- Right-click the Web Sites node andselect New, and then Web Site (From File) from the shortcut menu.
- The Import Configuration dialogbox opens
- Click Browse to select the exportfile which you want to import.
- Click Read to display the configurationin the Location list box
- Select the site and click OK.
- Enter the password that was usedto encrypt the file when it was exported.
- Click OK.
In order to import a previously exported file from one IIS machine to a different IIS machine, the following preparation tasks need to be performed.
- Delete or edit any referenceswithin the export file that are machine specific, such as
- Deleting AdminACL properties, password properties and properties referencing IUSR or IWAM accounts.
- Editing file system paths or locations which are different on the target machine.
- Create the required folders on thetarget machine.
- Right-click the IIS server, select All Tasks on the shortcut menu, and then click Restart IIS.
- You can choose between the following options:
- Restart IIS.
- Restart Server.
- Stop IIS.
- Start IIS.
You can use the Iisback.vbs WMI script to perform the management tasks listed below:
- Back up and restore IISconfiguration data.
- Delete IIS configuration data.
- View, or list IIS configurationdata.
How to export the metabase
You can export portions of the metabase, or the entire metabase configuration information to a file. You can basically export the configuration settings for only a particular website or virtual directory, or you can export all configuration settings. You can also through exporting, create a metabase template file to copy configuration information to multiple IIS machines. You can export metabase configuration information by using the IIS Manager, or the Iiscnfg.vbs WMI script.
To export the metabase using the IIS Manager,
- Open the IIS Manager.
- Right-click the IIS server whoseconfiguration setting you want o export, select All Tasks on the shortcut menu, and then click Save Configuration To A File.
- When the Save Configuration To A File dialog box opens, enter a name for the file in the File Name textbox.
- Verify that the correct locationis specified in the Path checkbox.
- Select the Encrypt Configuration Using Password checkbox.
- Click OK.
How to import the metabase
You can import previously exported files to the same IIS machine, or to a different IIS machine.
To import a previously exported file to the same IIS machine,
- Open the IIS Manager.
- Right-click the Web Sites node and select New, and then Web Site (From File) from the shortcut menu.
- The Import Configuration dialogbox opens.
- Click Browse to select the export file which you want to import.
- Click Read to display the configuration in the Location list box.
- Select the site and click OK
- Enter the password that was used to encrypt the file when it was exported.
- Click OK.
In order to import a previously exported file from one IIS machine to a different IIS machine, the following preparation tasks need to be performed.
- Delete or edit any references within the export file that are machine specific, such as
- Deleting AdminACL properties, password properties and properties referencing IUSR or IWAM accounts.
- Editing file system paths or locations which are different on the target machine.
- Create the required folders on the target machine.
Follow Us!