简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM