WorkflowRuntime.StopRuntime Método

Definición

Detiene el motor en tiempo de ejecución de flujo de trabajo y los servicios en tiempo de ejecución.

C#
public void StopRuntime();

Excepciones

Ejemplos

El ejemplo de código siguiente muestra cómo se puede utilizar la funcionalidad WorkflowRuntime desde un host del flujo de trabajo. StopRuntime se llama después de que el host haya completado el resto del procesamiento asociado al tiempo de ejecución.

Este ejemplo de código forma parte del ejemplo Cancelar un flujo de trabajo .

C#
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();
    }
}

Comentarios

Este método hace que el motor en tiempo de ejecución del flujo de trabajo descargue cada una de sus instancias de flujo de trabajo, detenga todos sus servicios derivados de la WorkflowRuntimeService clase , establezca en IsStartedfalsey genere el Stopped evento .

Para cerrar correctamente WorkflowRuntime, llame a StopRuntime antes de llamar a Dispose.

Para obtener más información, vea el método Dispose.

Se aplica a

Producto Versiones
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1