WorkflowRuntime.StopRuntime WorkflowRuntime.StopRuntime WorkflowRuntime.StopRuntime WorkflowRuntime.StopRuntime Method

Definition

Stoppt die Workflowruntime-Engine und die Laufzeitdienste.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 ()

Ausnahmen

Beispiele

Das folgende Codebeispiel zeigt, wie Sie die WorkflowRuntime-Funktionalität eines Workflowhosts verwenden können.The following code example demonstrates how to use WorkflowRuntime functionality from a workflow host. StopRuntime wird aufgerufen, nachdem der Host alle anderen Verarbeitungsschritte ausgeführt hat, die der Laufzeit zugeordnet sind.StopRuntime is called after the host has completed all other processing associated with the runtime.

Dieses Codebeispiel ist Teil des Beispiels für das Abbrechen eines Workflows .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

Hinweise

Diese Methode bewirkt, dass das Workflow Lauf Zeit Modul die einzelnen Workflow Instanzen entladen, alle zugehörigen Dienste stoppt WorkflowRuntimeService , die von der-Klasse abgeleitet sind, auf IsStarted falsefestgelegt und das Stopped -Ereignis auslöst.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.

Um die WorkflowRuntime ordnungsgemäß herunterzufahren, rufen Sie StopRuntime auf, bevor Sie Dispose aufrufen.To shut down the WorkflowRuntime gracefully, call StopRuntime before you call Dispose.

Weitere Informationen finden Sie unter der Methode Dispose.For more information, see the Dispose method.

Gilt für: