Saturday, May 31, 2008

IIS 7.0 Web Administration Techniques

tableWeb administrators have many options for managing IIS. The key administration tools are:

IIS Manager (InetMgr.exe)

IIS Administration objects made available through the IIS 7.0 WMI provider

IIS command-line administration tool (AppCmd.exe)

IIS Manager provides the standard administration interface for IIS. To start IIS Manager, click Start and choose All Programs, Administrative Tools, and then Internet Information Services (IIS) Manager. When started, IIS Manager displays the Start page and automatically connects to the local IIS installation, if it's available. On the Start page, you have the following options:

Connect to localhost Connects you to the IIS installation on the local computer

Connect to a server Allows you to connect to a remote server

Connect to a site Allows you to connect to a specific Web site on a designated Web server

Connect to an application Allows you to connect to a specific Web application on a designated site and server

Remote access to an IIS server is controlled by the WMSVC. When you install and start WMSVC on an IIS server, it listens on port 8172 on all unassigned IP addresses and allows remote connections from authorized user accounts. You can connect to a remote server by following these steps:

1.

In Internet Information Services (IIS) Manager, click Start Page in the console tree and then click Connect To A Server. This starts the Connect To A Server wizard.

2.

Type or select the server name in the Server Name box. For a server on the Internet, type the FQDN of the server, such as www.adatum.com. For a server on the local network, type the computer name, such as WEBSVR87. Port 80 is the default port for connections. As necessary, you can provide the port to which you want to connect. For example, if you want to connect to the server on port 8080, you would follow the server name by :8080, such as WEBSVR87:8080.

3.

After you type the server name (and optionally the port number), click Next. IIS Manager will then try to use your current user credentials to log on to the server. If this fails, you'll need to provide the appropriate credentials on the presented Provide Credentials page before clicking Next to continue. Click Finish to complete the connection.

Tip

If IIS Manager displays a connection error stating that the remote server is not accepting connections, you'll need to log on locally or through remote desktop. Once logged on, check to ensure the Management Service is started and configured properly.

You can connect to a specific Web site on a designated server by following these steps:

1.

In Internet Information Services (IIS) Manager, click Start Page in the console tree and then click Connect To A Site. This starts the Connect To A Site Wizard.

2.

Type or select the server name in the Server Name box, such as TESTSVR22. In the Site Name box, type or select the name of the Web site to which you want to connect, such as Default Web Site.

3.

Click Next. IIS Manager will then try to use your current user credentials to log on to the server. If this fails, you'll need to provide the appropriate credentials on the presented Provide Credentials page before clicking Next to continue. Click Finish to complete the connection.

You can connect to a specific application on a designated site and server by following these steps:

1.

In Internet Information Services (IIS) Manager, click Start Page in the console tree and then click Connect To An Application. This starts the Connect To An Application Wizard.

2.

Type or select the server name in the Server Name box, such as TESTSVR22. In the Site Name box, type or select the name of the Web site to which you want to connect, such as Default Web Site.

3.

In the Application Name box, type or select the relative path of the Web application to which you want to connect, such as /MyApplication or /Apps/Myapp.

4.

Click Next. IIS Manager will then try to use your current user credentials to log on to the server. If this fails, you'll need to provide the appropriate credentials on the presented Provide Credentials page before clicking Next to continue. Click Finish to complete the connection.

IIS Manager has been completely redesigned for IIS 7.0. Instead of being a snap-in for the Microsoft Management Console, IIS Manager is now a stand-alone application with a browser-like interface. Once you connect to a server, site, or application, IIS Manager automatically connects to these installations upon startup. You can change this behavior by disconnecting from the remote server while in IIS Manager.

IIS 7.0 introduces the concept of delegated administration. With delegated administration, a machine administrator can delegate administrative control safely and securely. Delegated administration allows different levels of the configuration hierarchy to be managed by other users, such as site administrators or application developers. In a standard configuration, the default delegation state limits write access to most configuration settings to machine administrators only, and you must explicitly modify the delegation settings to grant write access to others.

IIS Manager and other graphical tools provide just about everything you need to work with IIS 7.0. Still, there are times when you might want to work from the command line, especially if you want to automate installation or administration tasks. To help you with all your command-line needs, IIS 7.0 includes the IIS command-line administration tool (AppCmd.exe). AppCmd.exe is located in the %SystemRoot%\System32\Inetsrv directory. By default, this directory is not in your command path. Because of this, you'll need either to add this directory to the default path or change to this directory each time you want to use this tool. Add this directory temporarily to your default path by typing the following at an elevated command prompt:

path %PATH%;%SystemRoot%\System32\inetsrv

Then add this directory permanently to your default path by typing the following at an elevated command prompt:

setx PATH %PATH%;%SystemRoot%\System32\inetsrv

Note

You use Path to temporarily update the command path for the current window. You use SETX PATH to permanently update the command path for future command windows.

Summary of the core set of administration objects for the IIS command-line administration tool.

Administration Objects for the IIS Command-Line Administration Tool

Object Type

Description

Related Commands

APP

Allows you to create and manage Web application settings by using related list, set, add, and delete commands

list, set, add, and delete

APPPOOL

Allows you to create and manage application pools by using related list, set, add, delete, start, stop, and recycle commands

list, set, add, delete, start, stop, and recycle

BACKUP

Allows you to create and manage backups of your server configuration by using list, add, delete, and restore commands

list, add, delete, and restore

CONFIG

Allows you to manage general configuration settings by using related list, set, search, lock, unlock, clear, reset, and migrate commands

list, set, search, lock, unlock, clear, reset, and migrate

MODULE

Allows you to manage IIS modules by using related list, set, add, delete, install, and uninstall commands

list, set, add, delete, install, and uninstall

REQUEST

Allows you to list current HTTP requests by using a related list command

list

SITE

Allows you to create and manage virtual sites by using related list, set, add, delete, start, and stop commands

list, set, add, delete, start, and stop

TRACE

Allows you to manage failed request tracing by using related list, configure, and inspect commands

list, configure, and inspect

VDIR

Allows you to create and manage virtual directory settings by using related list, set, add, and delete commands

list, set, add, and delete

WP

Allows you to list running worker processes by using a related list command

list

The basics of working with the IIS command-line administration tool are straightforward. Most administration objects support these basic commands:

ADD Creates a new object with the properties you specify.

DELETE Deletes the object you specify.

LIST Displays a list of related objects. Optionally, you can specify a unique object to list, or you can type one or more parameters to match against object properties.

SET Sets parameters on the object specified.

Some objects support other commands, including:

RECYCLE Recycles the object you specify by deleting it and then re-creating it

START Starts the object you specify if it is stopped

STOP Stops the object you specify if it is started or otherwise active

To type commands, use the following basic syntax:

appcmd Command 

where Command is the action to perform, such as list, add, or delete, and Object-type is the object on which you want to perform the action, such as app, site, or vdir. Following this, if you wanted to list the configured sites on a server, you could type the following command at an elevated command prompt:

appcmd list site

Because the IIS command-line administration tool will also accept plural forms of object names, such as apps, sites, or vdirs, you could also use:

appcmd list sites

In either case, the resulting output is a list of all configured sites on the server with their related properties, such as:

SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

No comments: