IIS 6 Administration
|
|
Managing Applications and Web Service Extensions
You can also manage applications and web service extensions from the command line using two admin scripts provided with IIS 6:
-
The isapp.vbs script reports the process identifiers (PIDs) of worker processes (instances of W3pwp.exe) that are currently serving a specified application pool.
-
The iisext.vbs script enables, disables, or lists web service extensions; adds or removes application dependencies; enables or lists applications; and adds, removes, enables, disables, or lists individual files (DLLs or EXEs) needed by web service extensions.
This is pretty deep stuff, but a few examples will make things clear.
Note | Remember that web service extensions are ISAPI files (DLLs) or CGI executables (EXEs) that extend the functionality of IIS and enable it to serve different kinds of dynamic content or perform special actions. |
Listing Web Service Extensions
To list the IDs of all web service extensions defined on the machine, do this:
C:\>iisext /listext Connecting to server ...Done. SSINC ASP HTTPODBC WEBDAV
These extensions are all defined as entries under the WebSvcExtRestrictionList property in the metabase (we’ll look at the metabase in detail in Chapter 14, “Working with the Metabase”). The output of the command shows that Server Side Includes, Active Server Pages, Internet Data Connector, and WebDAV are all defined extensions on the machine (Figure 11-15). Note that this list shows what extensions are defined regardless of whether they are enabled or not.
Listing Files Associated with Web Service Extensions
To list the actual files (DLLs or EXEs) associated with these extensions, do this:
C:\>iisext /listfile Connecting to server ...Done. Status / Extension Path ———————————— 0 *.dll 0 *.exe 0 C:\WINDOWS\system32\inetsrv\ssinc.dll 1 C:\WINDOWS\system32\inetsrv\asp.dll 0 C:\WINDOWS\system32\inetsrv\httpodbc.dll 0 C:\WINDOWS\system32\inetsrv\httpext.dll
Note that this matches the information specified in Table 10-3 of Chapter 10, “Securing IIS.” The “1” at the start of the fourth line indicates that the asp.dll (Active Server Pages) extension is currently enabled on the server while the other extensions are disabled.
Enabling a Web Service Extension File
To enable the WebDAV (httpext.dll) extension, do this:
C:\>iisext /enfile C:\windows\system32\inetsrv\httpext.dll Connecting to server ...Done. Enabling extension file complete. C:\>iisext /listfile Connecting to server ...Done. Status / Extension Path ———————————— 0 *.dll 0 *.exe 0 C:\WINDOWS\system32\inetsrv\ssinc.dll 1 C:\WINDOWS\system32\inetsrv\asp.dll 0 C:\WINDOWS\system32\inetsrv\httpodbc.dll 1 C:\WINDOWS\system32\inetsrv\httpext.dll
This also verifies that the extension is enabled by running iisext /listfile again. You can similarly disable an extension using iisext /disfile and remove the extension entirely by removing the association with its DLL or EXE using iisext /rmfile.
Add a New Extension
To add a new file as a web service extension, do this:
C:\>iisext /addfile C:\windows\system32\blah.dll 0 Blah 1 "Extension for bored developers" Connecting to server ...Done. Adding extension file complete. C:\>iisext /listext Connecting to server ...Done. SSINC ASP HTTPODBC WEBDAV Blah C:\>iisext /listfile Connecting to server ...Done. Status / Extension Path ———————————— 0 *.dll 0 *.exe 0 C:\WINDOWS\system32\inetsrv\ssinc.dll 1 C:\WINDOWS\system32\inetsrv\asp.dll 0 C:\WINDOWS\system32\inetsrv\httpodbc.dll 1 C:\WINDOWS\system32\inetsrv\httpext.dll 0 C:\WINDOWS\system32\blah.dll
The iisext /addfile command has the following syntax:
-
C:\windows\system32\blah.dll specifies the DLL associated with the new extension.
-
The first number (0) indicates that the extension when created will be left disabled (using 1 instead will enable it).
-
“Blah” is the ID associated with the extension and will be displayed in IIS Manager when the Web Service Extensions (WSE) node is selected.
-
The second number (1) indicates that the extension can be removed afterward if desired (using 0 instead prevents this).
-
The string at the end is a short description of the extension, which also appears in IIS Manager
Running the preceding iisweb /listext command verifies that the extension has been defined, and running iisweb /listfile verifies the association with the DLL and that the extension is disabled.
Enabling a Web Service Extension
This is basically the same as enabling a web service extension file discussed previously, but is a little easier to do:
C:\>iisext /enext Blah Connecting to server ...Done. Enabling extension complete. C:\>iisext /listfile Connecting to server ...Done. Status / Extension Path ———————————— 0 *.dll 0 *.exe 0 C:\WINDOWS\system32\inetsrv\ssinc.dll 1 C:\WINDOWS\system32\inetsrv\asp.dll 0 C:\WINDOWS\system32\inetsrv\httpodbc.dll 1 C:\WINDOWS\system32\inetsrv\httpext.dll 1 C:\windows\system32\blah.dll
Here you can simply specify the ID (“Blah” in the example) of the extension you want to enable, which is easier than using iisweb /enfile and specifying the path to the DLL. Similarly, you can disable an extension using iisext /disext. Once again, you can verify that the extension is enabled by using iisext /listfile as in the previous session.
Managing Application Dependencies
The ApplicationDependencies list in the metabase manages the web service extensions that your web applications depend on. To display the contents of this list, do this:
C:\>iisext /listapp Connecting to server ...Done. Active Server Pages Internet Data Connector Server Side Includes WebDAV
To make the Accounting application dependent upon the Blah web service extension:
C:\>iisext /addep Accounting Blah Connecting to server ...Done. Adding dependency complete.
To remove this dependency, use iisext /rmdep; to enable an application, use iisext /enapp.
Listing Running Applications
You can use the iisapp script to list all running web applications, showing their process identity (PID) and the application pool they are assigned to. In order to make this more interesting, do the following: create a new application pool called AccountingAppPool and assign your Accounting website to this pool. Then add a simple ASP application to the home directory of both the Default Web Site and your Accounting website, open these applications in a browser (using http://172.16.11.215 and http://172.16.11.216), and do the following:
C:\>iisapp W3WP.exe PID: 3224 AppPoolId: DefaultAppPool W3WP.exe PID: 2844 AppPoolId: AccountingAppPool
Note that each application pool is serviced by a different worker process. If you have a lot of applications running on your machine and know the PID of the one you want to check on, do this:
C:\>iisapp /p 2844 W3WP.exe PID: 2844 AppPoolId: AccountingAppPool
|
|