ServiceDescription.Behaviors Property

 

Gets the behaviors associated with the service.

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

member Behaviors : KeyedByTypeCollection<IServiceBehavior> with get

Property Value

Type: System.Collections.Generic.KeyedByTypeCollection<IServiceBehavior>

The KeyedByTypeCollection<'TItem> of type IServiceBehavior that contains the behaviors associated with the service.

Use this method when adding custom behaviors to extend ServiceHost. Programmatically, you must Add('T) the custom service behavior to the Behaviors prior to when you call the Open method on the ServiceHost object.

The type of behavior that is accessible from the description hierarchy is scoped to the specific level. From the ServiceDescription the IServiceBehavior is accessible.

If you want access to the IEndpointBehavior associated with an endpoint instead, you can obtain the endpoints for the service using the Endpoints property. Then retrieve the ServiceEndpoint from the collection with the Find method that employs the relevant search criteria, and call the Behaviors property to obtain the collection of the IEndpointBehavior objects.

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

.NET Framework
Available since 3.0
Return to top
Show: