Microsoft KB Archive/243603

= PRB: Calling Third-Party Component Fails from Active Server Pages =

Article ID: 243603

Article Last Modified on 11/15/2006

-

APPLIES TO

 Microsoft Active Server Pages 4.0, when used with:  Microsoft Internet Information Server 3.0

 Microsoft Internet Information Server 4.0 

-



This article was previously published under Q243603



SYMPTOMS
When calling third-party Component Object Model (COM) components either directly from Active Server Pages (ASP) or indirectly through ASP using COM wrappers, the component does not behave as expected. The component may work correctly when called from a desktop client such as a Visual Basic or Visual C++ client form.



CAUSE
Many components are not designed to be called from ASP or to run in a multi-threaded environment under a service.



MORE INFORMATION
Typically one or more of the following issues may cause third-party components to fail or behave unexpectedly when called under ASP:
 * The component was designed for desktop use.
 * The component requires a specific security context.
 * The component requires a user interface or a host container.
 * The component was not designed to be used in a multi-threaded environment
 * The component expects a single thread of execution.

In general, you should use the following guidelines:
 * 1) Confirm with the development company of the third-party component that the component is designed to work under ASP.
 * 2) Confirm that the threading model of the component is safe for use under ASP. Single threaded components should not called from ASP because they do not marshal security context, and they lock the application down to a single thread of execution. Only Apartment (STA), Free, and Both threaded components can be used safely from ASP.
 * 3) Confirm that the component implements IDispatch. Working from ASP includes implementing IDispatch and the component needs to be thread-safe because ASP is a multi-threaded automation client.

Tip: If the third-party component information is not available directly from the development company, you can call the component from a Visual Basic client using late-binding (for example, Dim objServer as Object) to test IDispatch functionality. You can also inspect the registry for type information.

In general, Microsoft support boundaries include the following:
 * 1) Explaining the behavior of ASP as a multithreaded COM client:
 * 2) * Security implications running under Internet Information Server (IIS) as opposed to a desktop application
 * 3) * Threading guidelines under ASP
 * 4) * Scalability issues
 * 5) Assisting in problem isolation to determine if the problem lies within the third-party component.

<div class="references_section">