Reputation: 3226
Ive just checked AppDomain.CurrentDomain.GetAssemblies before and after an App Pool recycle and it appears that is the case. I dont understand why some 86 assemblies are loaded in the first instance, i.e. when I deploy the app and then only 28 are loaded after the recycle.
What could be happening?
Upvotes: 1
Views: 787
Reputation: 16187
It is a known behavior of IIS. After IIS recycle, assemblies are loaded on demand.
If you want to get all available assemblies, you can use GetReferencedAssemblies
method on the System.Web.Compilation.BuildManager
type.
For example :
IEnumerable<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies();
if (HostingEnvironment.InClientBuildManager)
{
assemblies = assemblies.Union(BuildManager.GetReferencedAssemblies().Cast<Assembly>());
}
Upvotes: 1