Share via


InstanceContext.GetServiceInstance Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Function GetServiceInstance ( _
    message As Message _
) As Object
public Object GetServiceInstance(
    Message message
)

Parameters

Return Value

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

Exceptions

Exception Condition
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.

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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