How to get a reference to IDuplexChannel, IDuplexSessionChannel or IOutputChannel in Wcf

Posted by wizlb on Stack Overflow See other posts from Stack Overflow or by wizlb
Published on 2010-03-12T17:03:45Z Indexed on 2010/03/12 17:07 UTC
Read the original article Hit count: 274

Filed under:
|
|

I have a duplex Wcf service and I'd like to get a reference to IDuplexChannel, IDuplexSessionChannel or IOutputChannel so that I can use the non-blocking BeginSend method.

On my server, inside of the handler for the initiating method I have the following (I have tried every interface that I listed in place of IOutputChannel. None of them seem to exist.)

_clientCb = OperationContext.Current.GetCallbackChannel<IDxClientCb>();
_channel = OperationContext.Current.Channel;
_duplexChannel = _channel as IOutputChannel;
Debug.Print("Service IOutputChannel null: {0}", _duplexChannel == null);

Similarly, in the client I have tried to cast the return value of DuplexChannelFactory.CreateChannel() to any of these interfaces and I always get back a null.

How do I get a reference to one of these?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET