WorkflowRuntime.StopRuntime 메서드

정의

워크플로 런타임 엔진과 런타임 서비스를 중지합니다.Stops the workflow run-time engine and the run-time services.

public:
 void StopRuntime();
public void StopRuntime ();
member this.StopRuntime : unit -> unit
Public Sub StopRuntime ()

예외

WorkflowRuntime이 이미 삭제된 경우The WorkflowRuntime is already disposed of.

예제

다음 코드 예제에서는 워크플로 호스트에서 WorkflowRuntime 기능을 사용하는 방법을 보여 줍니다.The following code example demonstrates how to use WorkflowRuntime functionality from a workflow host. StopRuntime은 호스트가 런타임과 연결된 다른 모든 처리를 완료한 후에 호출됩니다.StopRuntime is called after the host has completed all other processing associated with the runtime.

일부인이 코드 예제는 워크플로 취소 하면 샘플입니다.This code example is part of the Canceling a Workflow sample.

static void Main()
{
    string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;";

    using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
    {
        ExternalDataExchangeService dataService = new ExternalDataExchangeService();
        workflowRuntime.AddService(dataService);
        dataService.AddService(expenseService);

        workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString));
        workflowRuntime.StartRuntime();

        workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
        workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
        workflowRuntime.WorkflowIdled += OnWorkflowIdled;
        workflowRuntime.WorkflowAborted += OnWorkflowAborted;

        Type type = typeof(SampleWorkflow1);
        WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type);
        workflowInstance.Start();

        waitHandle.WaitOne();

        workflowRuntime.StopRuntime();
    }
}
Shared Sub Main()
    Dim connectionString As String = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"
    Using workflowRuntime As New WorkflowRuntime()
        Dim dataService As New ExternalDataExchangeService()
        workflowRuntime.AddService(dataService)
        dataService.AddService(expenseService)

        workflowRuntime.AddService(New SqlWorkflowPersistenceService(connectionString))


        AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted
        AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated
        AddHandler workflowRuntime.WorkflowIdled, AddressOf OnWorkflowIdled
        AddHandler workflowRuntime.WorkflowAborted, AddressOf OnWorkflowAborted


        Dim workflowInstance As WorkflowInstance
        workflowInstance = workflowRuntime.CreateWorkflow(GetType(SampleWorkflow))
        workflowInstance.Start()

        waitHandle.WaitOne()

        workflowRuntime.StopRuntime()
    End Using
End Sub

설명

이 메서드를 사용 하면 워크플로 런타임 엔진이 각 워크플로 인스턴스 언로드, 모든에서 파생 되는 서비스를 중지 하는 WorkflowRuntimeService 클래스에서 IsStartedfalse, 시키고는 Stopped 이벤트입니다.This method causes the workflow run-time engine to unload each of its workflow instances, stop all of its services that are derived from the WorkflowRuntimeService class, set IsStarted to false, and raise the Stopped event.

WorkflowRuntime을 올바르게 종료하려면 StopRuntime를 호출하기 전에 Dispose을 호출해야 합니다.To shut down the WorkflowRuntime gracefully, call StopRuntime before you call Dispose.

자세한 내용은 Dispose 메서드를 참조하세요.For more information, see the Dispose method.

적용 대상