public HostingEnvironment() { _registeredObjects = new Dictionary<IRegisteredObject, IRegisteredObject>(); _wellKnownObjects = new Dictionary<string, IRegisteredObject>(); if(_theHostingEnvironment != null) throw new InvalidOperationException("Only one HostingEnvironment allowed"); _theHostingEnvironment = this; _onAppDomainUnload = new EventHandler(OnAppDomainUnload); Thread.GetDomain().DomainUnload += _onAppDomainUnload; }
internal void HostingEnvironmentShutdownInitiated(string appId, HostingEnvironment env) { if (!_shutdownInProgress) { lock (this) { if(!env.HasBeenRemovedFromAppManagerTable) { env.HasBeenRemovedFromAppManagerTable = true; if( _appDomains.ContainsKey(appId) ) _appDomains.Remove(appId); } } } }