How are Threads created and managed by the HttpApplication?
How are threads created and managed by the HttpApplication in ASP.NET?
What determines if an HttpContext opens a new thread or uses an existing thread? How can this be controlled?
I will be happy with either a 开发者_开发知识库solid explanation or a link to a sufficient resource on this information.
How are Threads created and managed by the HttpApplication in ASP.NET?
They are drawn from a thread pool. They are not created at each request.
What determines if an HttpContext opens a new thread or uses an existing thread?
New threads are never created. They are drawn from the pool and returned to it once the request has been serviced.
How can this be controlled?
This is something that ASP.NET does very well and not something you want to control but you if you really insist on here's an article which explains how you could use STA threads instead of MTA threads in ASP.NET.
Here is an excellent post from Thomas Marquardt (a member of the Microsoft ASP.Net dev team who actually works on this very area) on ASP.NET thread use in IIS6 & IIS7:
http://blogs.msdn.com/b/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx
精彩评论