Setup -- Create a simple COM addin through DOTNET/C# that does nothing but sleep on the current thread for 5 seconds.
namespace ComTest
{
[ComVisible(true)]
[ProgId("ComTester.Tester")]
[Guid("D4D0BF9C-C169-4e5f-B28B-AFA194B29340")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Tester
{
[STAThread()]
public string Test()
{
System.Threading.Thread.Sleep(5000);
return DateTime.Now.ToString();
}
}
}
From an ASP page, call the test component:
<%@ Language=VBScript %>
<%option explicit%>
<%response.Buffer=false%>
<%
dim test
set test = CreateObject("ComTester.Tester")
%>
<HTML>
<HEAD></HEAD>
<BODY>
<%
Response.Write(test.Test())
set test = nothing
%>
</BODY>
</HTML>
When run on a windows 2003 server, the test.asp page blocks ALL OTHER threads in the site while the COM components sleeps.
How can I create a COM component for ASP that does not block all ASP worker threads?