PRB: Blocking/Serialization When Using InProc Component (DLL) from ASPID: Q216580
|
When calling an Active Server Page (ASP) page that instantiates an inproc component (DLL) from multiple clients, the user will see blocking/serialization; that is, all the clients have to wait for others to finish. If the inproc component is either Apartment or Multithreaded it should not behave this way.
The most common reasons for this behavior are listed below.
The IIS settings for your virtual directory may have the application debugging flags set. If application debugging is turned on, it will cause all requests to this virtual directory to be on a single thread.
Another common reason is that the different requests could run under the same Session ID and will, therefore, be serialized. This is usually the case if testing from multiple browser windows on a single machine.
Other reasons that can explain this behavior are mostly code related. Following are two code snipplets (Visual Basic and Visual C++) to be able to test and see if you are dealing with a coding issue (that is, the sample code works fine with no serialization), or with a configuration issue (that is, the sample code is showing the same behavior as described above).
Turn off application debugging at the virtual directory level:
This behavior is by design.
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Function ThreadWait(nSeconds As Long) As Long
Sleep nSeconds * 1000
ThreadWait = GetCurrentThreadId
End Function
STDMETHODIMP CThreadTest::ThreadWait(int n, long *threadid)
{
DWORD nthreadId;
nthreadId = GetCurrentThreadId();
Sleep (n * 1000);
*threadid = nthreadId;
return S_OK;
}
[id(1), helpstring("method ThreadWait")] HRESULT ThreadWait([in] int n, [out, retval] long* threadid);
<%
Dim objTest
Set objTest = Server.CreateObject("ThreadWaitProject.ThreadTest")
Response.Write "<TABLE border =1><TR><TD colspan=2 align=center><H3>InProc VB DLL<BR> ThreadWait 5 seconds</H3></TD></TR>"
Response.Write "<TR><TD>StartTime: </TD><TD>" & Now & "</TD></TR>"
Response.Write "<TR><TD>ThreadID: </TD><TD>" & objTest.ThreadWait(5) & "</TD></TR>"
Response.Write "<TR><TD>EndtTime: </TD><TD>" & Now & "</TD></TR>"
Response.write "<TR><TD>Session ID: </TD><TD>" & Session.SessionId & "</TD></TR></TABLE>"
Set objTest = Nothing
%>
Additional query words:
Keywords : kbActiveX kbASP kbATL kbIntl kbGrpASP kbDSupport
Version : WINDOWS:6.0; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbprb
Last Reviewed: February 25, 1999