PRB: Blocking Occurs When You Call a Visual Basic ActiveX EXE from Active Server Pages (201014)
The information in this article applies to:
- Microsoft Internet Information Server 4.0
- Microsoft Active Server Pages
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q201014 SYMPTOMS
When you instantiate an ActiveX EXE component from Active Server Pages (ASP) in page scope only, by default, all requests to the component are serialized to a single thread. This may cause contention and blocking.
CAUSE
Visual Basic 6.0 only supports Single-threaded or Apartment-threaded objects. By default, ActiveX EXE projects are set to the Apartment threading model. Thus, a Visual Basic ActiveX EXE is subject to the rules that COM imposes on single-threaded apartment (STA) objects.
If an object that runs in an STA is called concurrently by multiple clients (regardless of their threading model), COM synchronizes access to the object by posting window messages to the component's message queue. As a result, the object only receives one call each time it retrieves and dispatches a COM-related message.
Although this interference implies some performance penalty, it allows applications that support different threading models to work together. Thus, all possible combinations of client and out-of-process component interoperability are supported.
RESOLUTION
By default, the Instancing property of a Visual Basic ActiveX EXE is set to MultiUse. Therefore, only one server process is created using the STA model. Because Visual Basic only supports Single-threaded and STA objects, you cannot use either Free-threading or Both-threading to create multi-threaded objects. However, you can achieve concurrent execution as follows: - Increase the number of threads in the thread pool.
- In the Visual Basic project properties, set the "Thread by object" option.
Modification Type: | Major | Last Reviewed: | 11/26/2003 |
---|
Keywords: | kbprb KB201014 |
---|
|