Up until today I believed that each IIS "application" had its own specific instance of AppDomain, but debugging seems to show that the AppDomain
instance is shared between all IIS applications using the same IIS application pool.
Let the following IIS setup :
TestAppDomain
is what I call the website.
App1
, App2
and App3
are what I call applications.
Also let two applications pools : Pool 1-2
and Pool 3
App1
and App2
use Pool 1-2
, and App3
uses Pool 3
.
Apprently App1
and App2
will have a different AppDomain
instance than App3
, despite being part of the same website.
But, do App1
and App2
share the same AppDomain
instance ? Comparing the AppDomain
's friendly names in the debug spies shows the same name for both applications.
Thank you.
Each AppPool runs either a single process, or a group of processes, depending on the "Maximum Worker Processes" settings. All applications assigned to that pool will be served by the same process(es).
For .NET Framework, each application assigned to the pool will load in a separate AppDomain within the pool's process(es). No two applications will share an AppDomain.
Since .NET (Core/5+) no longer supports app domains, if you're using the in-process hosting model, each .NET application has to be assigned to a separate AppPool.