HOWTO: Launch LocalServer Components(EXEs) from ASP (IIS 4.0)

ID: Q184682


The information in this article applies to:


SUMMARY

Although most ActiveX Server components are dynamic-link libraries (DLLs), it is sometimes necessary to launch an EXE file from Active Server Pages (ASP). When Server.CreateObject is used to launch an EXE file, an error similar to the following may occur:

Server object error 'ASP 0196 : 80040154'

Cannot launch out of process component

/test/test.asp, line 12

Only InProc server components should be used. If you want to use
LocalServer components, you must set the AspAllowOutOfProcComponents
metabase setting. Please consult the help file for important
considerations.


MORE INFORMATION

This error is the result of a safety mechanism in Active Server Pages that prevents the launching of LocalServer components. This mechanism is in place because there are security concerns you should consider when launching out-of-process components. In addition to the security concerns, DLLs are also preferred because of their performance benefits over EXEs, and their ability to be hosted by Microsoft Transaction Server (MTS).

To override this safety mechanism, you must change the value in the AspAllowOutOfProcComponents metabase setting to TRUE. This metabase setting is accessible through the IIsWebService and IIsWebVirtualDir Admin objects.


Notes on Accessing the Metabase

You must have adequate permissions to modify the metabase. If you attempt to modify the metabase from an ASP script without sufficient permissions, you may encounter an "Invalid Syntax" error or other error. One possible workaround is to force authentication as a user with Administrative rights on the ASP page that makes the metabase modifications.

ASP scripts that access the metabase must be run from In-Proc Applications. If you have marked your application to "Run as separate memory space" in the MMC, you will receive an "Invalid Syntax" or other error message when the ASP script attempts to access the metabase.

Configuring the Metabase for AspAllowOutOfProcComponents

The following ASP code segment demonstrates the steps required to set the AspAllowOutOfProcComponents parameter on the IIsWebService Admin object.

   <%
     ' Get the IIsWebService Admin Object
     Set WebServObj = GetObject("IIS://LocalHost/W3svc")

     ' Enable the AspAllowOutOfProcComponents Parameter
     WebServObj.Put "AspAllowOutOfProcComponents", True

     ' Save the changed value to the metabase
     WebServObj.SetInfo
    %> 

The following ASP code segment demonstrates the steps required to set the AspAllowOutOfProcComponents parameter on the IIsWebVirtualDir Admin Object.

   <%
     ' Get the IIsWebVirtualDir Admin Object
     Set VDirObj = GetObject("IIS://LocalHost/W3svc/1/Root/vdir_name")

     ' Enable the AspAllowOutOfProcComponents Parameter
     VDirObj.Put "AspAllowOutOfProcComponents", True

     ' Save the changed value to the metabase
     VDirObj.SetInfo
    %> 

NOTE: You will need to restart the Web server after making these changes. To restart the Web server, type the following at a command prompt:

   c:\> net stop iisadmin /y
   c:\> net start w3svc 


REFERENCES

For more information on the issues surrounding launching LocalServers from ASP, refer to the Internet Information Server (IIS) Release Notes under the "Other Known Problems and Limitations" section.

For more information on the IIS Admin objects, refer to the IIS Programmer's Reference under the IIS Administration topic.

This article applies to IIS 4.0. For additional information on IIS 3.0, please see the following article in the Microsoft Knowledge Base:

Q175166 Launching LocalServer Components(EXEs) from ASP (IIS 3.0)

Additional query words: AspAllowOutOfProcComponents OutProc


Keywords          : kberrmsg kbASP kbASPObj kbCOMt kbScript kbSecurity kbGrpASP 
Version           : winnt:4.0
Platform          : winnt 
Issue type        : kbhowto 

Last Reviewed: August 9, 1999