Assembly: System.Workflow.Runtime (in system.workflow.runtime.dll)
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.
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.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.