InstanceContext.GetServiceInstance Method

Returns the instance of the service for the instance context in response to an incoming message.

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

public Object GetServiceInstance(
	Message message
)

Parameters

message
Type: System.ServiceModel.Channels.Message
The incoming message that triggered the creation of a service object.

Return Value

Type: System.Object
The object that represents the service instance.

ExceptionCondition
InvalidOperationException

The service instance is in a created or opening state or is not initialized.

CommunicationObjectAbortedException

The service instance is aborted.

ObjectDisposedException

The service instance has been closed already and cannot be modified in these states.

CommunicationObjectFaultedException

The service instance is faulted and cannot be modified in these states.

The general idea is that you create an instance of the service only when a message directed at it arrives, by calling Open; then if no message arrives, no InstanceContext is created and no service object is created, and so resources are not deployed until actually required.

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: