Relationship between threads, app domains and worker processes

asp.netiisiis-7multithreading

In IIS7 and ASP.NET, what is the exact relationship among:

  • IIS Worker Processes
  • Threads
  • AppDomains
  • Applications, and
  • incoming requests.

I'm hoping for an answer in a format similar to :

"Each IIS worker process hosts many appdomains which each spawn a single thread in response to each request…." etc. , and any nuances mentioned.

Best Answer

Each worker process hosts several AppDomains (at least one per ASP.NET app, i.e. a Website or Virtual Directory). An incoming request is assigned a thread from thread pool when it comes.

OP: Q. So each appdomain owns and manages its own thread pool?

Each managed Thread is always assigned to a single AppDomain at a time. The worker process maintains a shared thread pool and it's assigned to a specific AppDomain for the duration of a request.