Difference between an application domain and an application pool? Difference between an application domain and an application pool? asp.net asp.net

Difference between an application domain and an application pool?


IIS process is w3wp;Every application pool in IIS use it's own process; AppPool1 uses process 3784, AppPool2 uses process 5044Different applications in Asp.net will use different AppDomain;

AppTest1 and AppTest2 are in different AppDomain, but in the same process.

What's the point to use them?

Application pool and AppDomain , both of them can provide isolations, but use different approaches. Application pool use the process to isolate the applications which works without .NET. But AppDomain is another isolation methods provided by .NET.If your server host thousands of web sites, you wont use thousands of the application pool to isolate the web sites, just because, too many processes running will kill the os. However, sometime you need application pool. One of the advantages for application pool is that you can config the identity for application pool. Also you have more flexible options to recycle the application pool. At least right now, IIS didn't provide explicit options to recycle the appdomain.

An application pool is a group of one or more URLs ofdifferent Web applications and Web sites. Any Web directoryor virtual directory can be assigned to an application pool.Every application within an application pool shares the sameworker process executable, W3wp.exe, the worker process thatservices one application pool is separated from the workerprocess that services another [Like starting MS Word andopening many word documents]. Each separate worker processprovides a process boundary so that when an application isassigned to one application pool, problems in otherapplication pools do not affect the application. Thisensures that if a worker process fails, it does not affectthe applications running in other application pools. [i.e]for Eg., If word document is having issue it should notlogically affect your Excel Sheet isn’t it.application domain is a mechanism (similar to a process inan operating system) used to isolate executed softwareapplications from one another so that they do not affecteach other. [i.e] opening of MS WORD doesn’t affect MS EXCELyou can open and close both the applications any time sincethere is no dependency between the applications. Eachapplication domain has its own virtual address space whichscopes the resources for the application domain using thataddress space.

Thanks to this link