ServiceBase.OnContinue 方法


在衍生類別中實作時,當服務控制管理員 (SCM) 傳送繼續命令給服務時,將執行 OnContinue()When implemented in a derived class, OnContinue() runs when a Continue command is sent to the service by the Service Control Manager (SCM). 指定暫停服務後要繼續正常運作所要執行的動作。Specifies actions to take when a service resumes normal functioning after being paused.

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


執行OnContinue以鏡像應用程式的OnPause回應。Implement OnContinue to mirror your application's response to OnPause. 當您繼續服務(透過 [服務] 主控台或以程式設計方式) OnContinue時,處理就會執行,而且服務會再次變成作用中狀態。When you continue the service (either through the Services console or programmatically), the OnContinue processing runs, and the service becomes active again.

OnContinueCanPauseAndContinue屬性為true時,應該會覆寫。OnContinue is expected to be overridden when the CanPauseAndContinue property is true.

如果CanPauseAndContinue OnPause OnContinuefalse,則 SCM 不會將暫停或繼續要求傳遞至服務,因此即使已實作為和方法,也不會呼叫和方法。If CanPauseAndContinue is false, the SCM will not pass Pause or Continue requests to the service, so the OnPause and OnContinue methods will not be called even if they are implemented. Pause SCM 中,當為Continue CanPauseAndContinue false時,會停用和控制項。In the SCM, the Pause and Continue controls are disabled when CanPauseAndContinue is false.