Issue with maxWorkerThreads and thread count
Posted
by
Kartik M
on Stack Overflow
See other posts from Stack Overflow
or by Kartik M
Published on 2010-12-23T11:20:17Z
Indexed on
2010/12/24
14:54 UTC
Read the original article
Hit count: 317
I have created an ASP.NET application which creates threads in an infinite loop. I set maxWorkerThreads
to 20 in processModel
in machine.config
.
When I checked the Thread count in perfmon there was around 7000 threads created in worker process.
In PageLoad()
I have:
using System.Threading;
...
int count = 0;
var threadList = new System.Collections.Generic.List<System.Threading.Thread>();
try
{
while (true)
{
Thread newThread = new Thread(ThreadStart(DummyCall), 1024);
newThread.Start();
threadList.Add(newThread);
count++;
}
}
catch (Exception ex)
{
Response.Write(count + " : " + ex.ToString());
}
Function:
void DummyCall()
{
System.Threading.Thread.Sleep(1000000000);
}
How do I restrict thread creation in ASP.NET with IIS6/7?
© Stack Overflow or respective owner