แก้ไข

แชร์ผ่าน


WorkflowRuntimeService.Stop Method

Definition

When overridden in a derived class, stops the service and changes the State to Stopping.

protected public:
 virtual void Stop();
protected internal virtual void Stop ();
abstract member Stop : unit -> unit
override this.Stop : unit -> unit
Protected Friend Overridable Sub Stop ()

Exceptions

Runtime is a null reference (Nothing in Visual Basic).

-or-

The service has not yet been started.

Remarks

Stop is invoked by the workflow runtime engine on all of its services that derive from the WorkflowRuntimeService class when StopRuntime is called. Stop is also invoked by the workflow runtime engine when a workflow runtime engine service is removed from the workflow runtime engine by a call to RemoveService. The default implementation of Stop tracks whether the service has been started and uses this information to throw the appropriate exception if the service is stopped before it is started.

You can provide additional functionality necessary to have your service stopped by the workflow runtime engine by overriding this method. There is no guarantee about which, if any, services will be stopped or running when Stop is called on your service. The workflow runtime engine raises the WorkflowRuntime.Stopped event after it has called the Stop method of all of its workflow runtime engine services. Your service may need to retain some residual functionality to support other services until all the workflow runtime engine services have had their stop methods invoked by the workflow runtime engine. If your service must retain such functionality, you can override the OnStopped method to perform any additional action required to finish stopping your service when the WorkflowRuntime.Stopped event is raised.

Note

If your WorkflowRuntimeService is removed from the workflow runtime engine by a call to RemoveService while the workflow runtime engine is running, the workflow runtime engine will call Stop on your service. However, in this situation, the OnStopped method will not be called for your service. Therefore, your service may have to perform any additional shutdown functionality that it would ordinarily perform in OnStopped from inside the Stop method. You can test IsStarted to determine whether the workflow runtime engine is running.

Stop should only be called by the workflow runtime engine.

Applies to