tags:

views:

16

answers:

0

Uhm, I’m utterly lost so any help would be much appreciated

The OperationContext.Current.InstanceContext is the context of the current service instance that the incoming channel is using.

In a Duplex system, the service can callback to the client via a CallbackContract. This CallbackContract is much like a service on the client side that is listening for calls from the service on the channel that the client has opened. This “client callback service” can only be accessed via the same channel it used on the service and therefore only that service has access to it.

a) So in duplex systems the same channel instance with which client-side sends messages to the service, is also used by client to receive messages from the service?

b) If in request-reply system a client uses particular channel instance clientChannel to send a message to the service, then I assume this same instance ( thus clientChannel ) needs to stay opened until service sends back a reply to this instance, while in duplex system clientChannel needs to stay opened until the session is closed?

c) I’m assuming such behaviour since as far as I can tell each channel instance has a unique address ( or ID ) which helps to differentiate it from other channel instances ) running on the same client? And when service sends back a message, it also specifies an ID of this channel?

Thus when in Duplex system client calls a service, WCF creates ( on client side ) a channel instance clientChannel, which sends a message over the wire. On server’s side WCF creates channel instance serverChannel, which delivers the message to requested operation(method). When this method wants to callback to the client via CallbackContract, it uses InstanceContext.GetCallBackChannel<> to create a channel, which among other things contains the ID of the channel that called a service ( thus it contains an exact address or ID of clientChannel )?

d) Does in duplex systems client use the same channel instance to call any of endpoint’s operations?

Thank you