Recipe12.15.Enabling Direct Metabase Editing


Recipe 12.15. Enabling Direct Metabase Editing

Problem

You want to edit the metabase while IIS is still running. You may need to do this to configure metabase properties that are not accessible from the GUI.

Solution

Using a graphical user interface

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, right-click on the node representing your IIS server and select Properties.

  3. Select the Enable Direct Metabase Edit checkbox and click OK.

You can now use Notepad or some other text editor to edit the %SystemRoot%\system32\inetsrv\MetaBase.xml file as desired while IIS is running.

Using a command-line interface

To enable edit-while-running from the local server's command line, you have to first stop all IIS services:

> iisreset /stop

Use a text editor to open the metabase configuration file %SystemRoot%\system32\inetsrv\MetaBase.xml and change the line:

EnableEditWhileRunning = "0"

to:

EnableEditWhileRunning = "1"

Save your changes and then type the following command to restart IIS services:

> iisreset /start

Using VBScript
' This code enables the direct metabase editing setting ' ------ SCRIPT CONFIGURATION ------ strComputer = "<ServerName>" ' ------ END CONFIGURATION --------- set objServer = GetObject("IIS://" & strComputer) objServer.EnableEditWhileRunning = 1 objServer.EnableHistory = 1 objServer.SetInfo WScript.Echo "Successfully enabled direct metabase editing on server " & _              objServer.Name

Discussion

When IIS is running, it uses an in-memory copy of the metabase. If you make a change to the metabase, the change takes effect immediately in the in-memory metabase, and 60 seconds later IIS writes the changes to the MetaBase.xml file on disk. If, however, another metabase change is made before the 60 seconds are up, the timer resets to 60 seconds again (this can happen five times). Saving your IIS configuration or stopping the IISAdmin service also flushes the in-memory metabase to disk.

Be careful when modifying the metabase directlyif you make a mistake and the metabase becomes corrupted, IIS may not start and you'll have to restore the metabase from backup (see Recipe 12.16). When possible, try to avoid editing the metabase directly and use the GUI or a programmatic method instead.

The IIS 6 Resource Kit Tools includes Version 1.6 of Metabase Explorer (MBExplorer.exe), a graphical tool that you can use to view and edit the metabase on local or remote IIS computers. MBExplorer replaced MetaEdit tool on older versions of IIS. Figure 12-4 shows MBExplorer focused on the default web site.

Figure 12-4. MBExplorer view of the default web site


For a bird's eye view of the hierarchical structure of the IIS 6 metabase, see the article "Inside the XML Metabase of IIS6" by Mitch Tulloch (http://www.windowsdevcenter.com/pub/a/windows/2004/07/13/iis_metabase.html). For a more detailed look at the metabase, see Mitch's book, IIS 6 Administration, from Osborne/McGraw-Hill.


Using VBScript

To enable direct metabase editing using ADSI, you have to set the EnableEditWhileRunning and EnableHistory properties to 1. The EnableHistory property causes IIS to create a backup copy of the metabase every time the in-memory version of the metabase is written to disk. This is a precautionary measure to ensure that you don't get yourself into too much trouble by corrupting the metabase. With the history feature, you can restore previous versions of the metabase.

See Also

Recipe 12.16, MS KB 814871 (INFO: IIS 6.0 Metabase Documentation), and MS KB 267904 (SAMPLE: Metaacl.exe Modifying Metabase Permissions for the IIS Admin Objects)



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net