Article ID: 289112 - Last Review: June 23, 2005 - Revision: 4.4 How To Initialize a COM Apartment in an ISAPI Extension or FilterThis article was previously published under Q289112 We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site: http://www.microsoft.com/technet/security/prodtech/IIS.mspx
(http://www.microsoft.com/technet/security/prodtech/IIS.mspx)
SUMMARY
This article describes how to initialize a Component Object Model (COM) apartment in an Internet Server API (ISAPI) extension or filter. To use a COM component in an ISAPI filter, you need to fully understand how COM apartments and ISAPI thread pools interact.
MORE INFORMATION
Internet Information Server (IIS) is a multithreaded application, and the ISAPI extension is called on different threads for each request. When a threading model mismatch occurs, COM creates the component in a thread of its own. This thread inherits the credentials of the calling process, which is InetInfo.exe. To correctly initialize the desired COM apartment in an ISAPI extension or filter, you must create a separate thread and initialize that thread with the required apartment.
ASP threads are initialized as apartment threads in both the IIS 4.0 and the IIS 5.0 threading models. However, to use COM in ISAPI, you should not initialize COM or make a COM call in the GetExtensionVersion function unless you require that these calls be made under the credentials of either the SYSTEM account (for low-security ISAPI DLLs) or the IWAM_machinename account (for medium- or high-security ISAPI DLLs). You can use COM in ISAPI in the following two ways:
REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
197728
(http://support.microsoft.com/kb/197728/EN-US/
)
Creating a Thread Pool for MFC-Based ISAPI Extensions
150777
(http://support.microsoft.com/kb/150777/EN-US/
)
INFO: Descriptions and Workings of OLE Threading Models
185518
(http://support.microsoft.com/kb/185518/EN-US/
)
How To Implement Worker Threads Using MFC ISAPI Extension
For more information, see the following Microsoft Web site:
Processes, Threads, and Apartments http://msdn.microsoft.com/en-us/library/ms693344(VS.85).aspx (http://msdn.microsoft.com/en-us/library/ms693344(VS.85).aspx)
| Article Translations
|
Back to the top
