How can I create a DOTNET COM interop assembly for Classic ASP that does not sequentially block othe
Posted
by Alex Waddell
on Stack Overflow
See other posts from Stack Overflow
or by Alex Waddell
Published on 2010-05-14T18:15:58Z
Indexed on
2010/05/14
20:54 UTC
Read the original article
Hit count: 219
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?
© Stack Overflow or respective owner