WorkflowRuntime.RemoveService(Object) Méthode

Définition

Supprime le service spécifié du moteur d'exécution de workflow.

public:
 void RemoveService(System::Object ^ service);
public void RemoveService (object service);
member this.RemoveService : obj -> unit
Public Sub RemoveService (service As Object)

Paramètres

service
Object

Objet représentant l'instance de service à supprimer.

Exceptions

service est une référence Null (Nothing en Visual Basic).

L'objet WorkflowRuntime est déjà supprimé.

Le moteur d'exécution du flux de travail a démarré (IsStarted est true) et service est un service principal.

  • ou - service n'est pas enregistré auprès du moteur d'exécution de workflow.

Exemples

Dans l'exemple suivant, une SqlWorkflowPersistenceService est ajoutée et supprimée du WorkflowRuntime.

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Create a new instance of the out-of-box SqlWorkflowPersistenceService
SqlWorkflowPersistenceService persistenceService =
   new SqlWorkflowPersistenceService(
   "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;");
// Add the service to the runtime
workflowRuntime.AddService(persistenceService);
// Start the runtime
workflowRuntime.StartRuntime();
// Stop the runtime
workflowRuntime.StopRuntime();
// Remove the service from the runtime
workflowRuntime.RemoveService(persistenceService);
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Create a new instance of the out-of-box SqlWorkflowPersistenceService
Dim persistenceService As New SqlWorkflowPersistenceService( _
   "Initial Catalog=SqlPersistenceServiceData Source=localhostIntegrated Security=SSPI")
' Add the service to the runtime
workflowRuntime.AddService(persistenceService)
' Start the runtime
workflowRuntime.StartRuntime()
' Stop the runtime
workflowRuntime.StopRuntime()
' Remove the service from the runtime
workflowRuntime.RemoveService(persistenceService)

Remarques

Vous ne pouvez pas supprimer un service principal pendant que le moteur d’exécution du flux de travail est en cours d’exécution (IsStarted est true). Les services principaux sont des services qui dérivent des classes WorkflowSchedulerService, WorkflowCommitWorkBatchService, WorkflowPersistenceService ou TrackingService. Si service dérive de la classe WorkflowRuntimeService, RemoveService appelle la méthode Stop implémentée par service.

S’applique à