OperationContext::GetCallbackChannel<T> Method ()

 

Gets a channel to the client instance that called the current operation.

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

public:
generic<typename T>
T GetCallbackChannel()

Return Value

Type: T

A channel to the client instance that called the operation of the type specified in the CallbackContract property.

Type Parameters

T

The type of channel used to call back to the client.

Call the GetCallbackChannel<T> property to obtain a channel that you can use to call operations on the client instance that called the service.

The following code example uses the Current property and GetCallbackChannel<T> method to create a channel back to the caller from within a operation. All operations in this example are one-way operations, enabling the service and the client to communicate in both directions independently. In this case, the example client application expects only one return call before it exits, but another client, for example a Windows Forms client, can receive any number of calls from the service.

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

The following client implements the SampleDuplexHelloCallback to receive the callback message. The imported callback contract is not the same name as the one in the service, due to the use of the Name property in the preceding example. Note that the client makes no assumptions about whether or when it might receive a callback; the server callback is entirely independent of the client's outbound call.

System_CAPS_noteNote

For an example that uses the OperationContext class in a client scenario, see OperationContextScope.

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

.NET Framework
Available since 3.0
Return to top
Show: