WorkflowRuntime.GetService Method (Type)


Retrieves a service of the specified Type from the workflow run-time engine.

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public object GetService(
	Type serviceType


Type: System.Type

The Type of the service to retrieve.

Return Value

Type: System.Object

The service of the specified Type.

Exception Condition

serviceType is a null reference (Nothing in Visual Basic).


The WorkflowRuntime is already disposed of.


More than one service of type serviceType was found.

GetService throws an InvalidOperationException if more than one service exists for the specified Type. Therefore, you should use one of the overloaded methods of GetAllServices if it is possible that multiple services of the specified type are present in the WorkflowRuntime. For example, the workflow run-time engine may have multiple tracking services. If you request a tracking service by specifying the TrackingService base class, it is possible that an exception will be thrown.

.NET Framework
Available since 3.0
Return to top