ServiceDescription.GetService Method (Object)


Returns a service description initialized with a specified service object.

Namespace:   System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

static member GetService : 
        serviceImplementation:Object -> ServiceDescription


Type: System.Object

The Object that implements the service.

Return Value

Type: System.ServiceModel.Description.ServiceDescription

The ServiceDescription for the service object provided.

Exception Condition

serviceImplementation is null.

Use this method to reflect on behaviors using the Windows Communication Foundation (WCF) programming model when replacing ServiceHostBase with you own hosting mechanism.

GetService(Object) initializes the Name, Namespace, and ConfigurationName properties, and ensures that the ServiceBehaviorAttribute is attached to the service and adds any relevant service behaviors to Behaviors.

The following sample shows how to iterate through the service behaviors contained in the service description.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top