WorkflowRuntime.RemoveService(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從工作流程執行階段引擎中移除指定的服務。
public:
void RemoveService(System::Object ^ service);
public void RemoveService (object service);
member this.RemoveService : obj -> unit
Public Sub RemoveService (service As Object)
參數
- service
- Object
物件,表示要移除的服務。
例外狀況
service
為 null 參考 (在 Visual Basic 中為 Nothing
)。
範例
在下列範例中,將在 SqlWorkflowPersistenceService 中加入並移除 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)
備註
當工作流程執行時間引擎執行 () IsStartedtrue
時,您無法移除核心服務。 核心服務是衍生自 WorkflowSchedulerService 類別、WorkflowCommitWorkBatchService 類別、WorkflowPersistenceService 類別和 TrackingService 類別的服務。 如果 service
衍生自 WorkflowRuntimeService 類別,RemoveService 會呼叫由 Stop 實作的 service
方法。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應