John Sudds
Programming Writer, BackOffice SDK
Microsoft Corporation
January 30, 1998
Contents
Introduction
What Is an Out-of-Process Component?
Using the Metabase
This article describes how to access and change the parameters of the Microsoft® Internet Information Server (IIS) metabase to allow out-of-process components to run on your site. It discusses what an out-of-process component is, as well as the performance, security, and scalability tradeoffs out-of-process components can introduce to a site.
COM objects are implemented inside a server. Most of the time, the COM server is implemented as a DLL that executes in the same process as the client application. Sometimes the COM server is implemented as an executable that runs in a separate process from the client. For instance, when you create an instance of an Active Document server such as Microsoft Word, you actually launch a copy of the server application. When you instantiate such an object from Active Server Pages (ASP), you create a new process on the Web server. Because the Active Document server is an executable rather than a DLL, it cannot be loaded into the IIS process.
When you use Server.CreateObject in an ASP page to launch an out-of-process component, and IIS has not been configured to allow out-of-process components, it will return the following error:
Server object error 'ASP 0196' Cannot launch out of process component /myvroot/launch_exe.asp, line 16
This is the result of an ASP safety mechanism that prevents executables (but not DLLs) from being launched directly from ASP.
There are several reasons for this safeguard. Not all executables are safe to use on the server, and some may pose security risks. Also, because in-process component DLLs are faster, more secure, and can be hosted by Microsoft® Transaction Server (MTS), they are much better suited for server-side use.
Further, out-of-process components often create individual server processes for each object instance, reducing their performance to that of CGI applications. They simply do not scale as well as component DLLs that run in-process with IIS or MTS. If performance and scalability are priorities for your site, using out-of-process components is strongly discouraged. On the other hand, intranet sites that receive moderate to low traffic might be able to use an out-of-process component without adversely affecting the site's overall performance.
The IIS metabase stores Internet Information Server configuration settings. It performs some of the same functions as the system registry, but uses Active Directory Service Interfaces (ADSI) to administer this high-use storage facility.
If you want to enable the use of out-of-process components, you must set the IIS metabase property AspAllowOutOfProcComponents to TRUE. This setting is accessible from either the IIsWebService or IIsWebVirtualDir Admin objects.
If you set the AspAllowOutOfProcComponents property to TRUE on the IIsWebService object, all in-process applications will be able to launch executables from script. An in-process application is a virtual directory that has been marked as an application starting point, but which does not have the Run in separate memory space option selected in Internet Service Manager.
If you set the AspAllowOutOfProcComponents property to TRUE on the IIsWebVirtualDir object, and it contains an application that has been marked to Run in separate memory space as an isolated process, only the affected application may launch executables from script. If the application is set to run in-process, the setting will have has no effect.
The following ASP code demonstrates the steps required to set the AspAllowOutOfProcComponents parameter on the IIsWebService Admin object. You will need to restart the Web server service (by stoping and starting the IIS Admin Service in the Service Control Manager) after making this change.
<% ' Get the IIsWebService Admin object Set oWebService = GetObject("IIS://LocalHost/W3svc") ' Enable AspAllowOutOfProcComponents oWebService.Put "AspAllowOutOfProcComponents", True ' Save the changed value to the metabase oWebService.SetInfo %>
You could also use the sample ASP page we've developed solely for the purpose of modifying this metabase setting.
Download our ASP Metabase modifier (zipped, 2K).
Download the sample to your local IIS computer, unzip it, and install it into your Web root directory, C:\Inetpub\wwwroot. After you have loaded it in your root directory, activate it using your browser by typing http://localhost/oopcomp.asp in the address window. (At this point, you may be asked to provide your Windows NT account information if Basic Authentication is enabled.) You should see your Windows® NT user account displayed at the bottom of the page. If you don't see an account name, you are accessing the page anonymously and may not be able to modify IIS metabase properties. (You will be asked to provide your Windows NT account information at the prompt.) Where you see <approot> displayed, enter the name of the application root directory that you want to launch out-of-process components. If the application root directory was created in a Web site other than the default, you must also change the root ordinal value. (1="Default Web Site", 2="Adminstration Web Site", and so on.) Click the Set button when finished.
You should now see a message confirming that the metabase has been updated. Before you restart the Web Server service, however, be sure to select the Run in separate memory space option in Internet Service Manager for the application root you modified.
Note that you must have adequate permission to modify the metabase. If you attempt to modify the metabase from an ASP script without sufficient privileges, you may encounter an "Invalid Syntax" or other error. In order to modify the metabase from script, you must first gain access to the server as a user with administrative rights.
Be warned, too, that because the metabase stores IIS configuration settings through the ADSI, configuring properties incorrectly can cause problems, including the failure of your Web site. You should really only edit metabase properties for settings that you cannot adjust in the user interface.