HostingEnvironment.InitiateShutdown 方法
定义
开始关闭与此宿主关联的 Web 应用程序,并从系统中移除注册对象。Starts shutting down the web application associated with this host and removes registered objects from the system.
public:
static void InitiateShutdown();
public static void InitiateShutdown ();
static member InitiateShutdown : unit -> unit
Public Shared Sub InitiateShutdown ()
注解
使用 InitiateShutdown 方法可停止 web 应用程序域,并删除任何注册到方法的对象 RegisterObject 。Use the InitiateShutdown method to stop a web application domain and remove any objects registered with the RegisterObject method. 此方法会在关闭完成前立即返回。This method returns immediately, before the shutdown is complete.
对 Stop 每个已注册的对象调用方法,并将传递的参数设置为,以 false 允许每个已注册的对象异步关闭。The Stop method is called on each registered object with the passed parameter set to false to allow each registered object to shut down asynchronously. 等待配置元素的属性中指定的时间量后 shutdownTimeout ,将 <hostingEnvironment> Stop 再次调用方法,并将 true 为每个已注册的对象保留的传递参数设置为。After waiting for the amount of time specified in the shutdownTimeout attribute of the <hostingEnvironment> configuration element, the Stop method is called again with the passed parameter set to true for each registered object remaining.
所有已注册对象关闭后,对象将关闭 HostingEnvironment 应用程序域。Once all registered objects have finished shutting down, the HostingEnvironment objects shuts down the application domain.