Customization. Create a simple COM add-on via DOTNET / C # that does nothing but sleep in 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();
}
}
}
On the ASP page, invoke 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 on the site while the COM components are sleeping.
How to create a COM component for ASP that does not block all ASP worker threads?
source
share