ServiceBase.OnShutdown 方法

定義

在衍生類別中實作時,當系統正在關閉時執行。When implemented in a derived class, executes when the system is shutting down. 指定緊接在系統關閉之前應該發生的處理。Specifies what should occur immediately prior to the system shutting down.

protected:
 virtual void OnShutdown();
protected virtual void OnShutdown ();
abstract member OnShutdown : unit -> unit
override this.OnShutdown : unit -> unit
Protected Overridable Sub OnShutdown ()

備註

使用OnShutdown指定系統關閉時所發生的處理。Use OnShutdown to specify the processing that occurs when the system shuts down.

只有當作業系統已關閉,而不是在電腦關閉時,才會發生此事件。This event occurs only when the operating system is shut down, not when the computer is turned off.

OnShutdownCanShutdown屬性為true時,應該會覆寫。OnShutdown is expected to be overridden when the CanShutdown property is true.

適用於

另請參閱