开发者

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

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 IOutputCha开发者_开发百科nnel 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?


Why do you want to do that? If you want to do async operations, just declare your callback contract with async operations and use those instead? (see http://msdn.microsoft.com/en-us/library/ms734701.aspx)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜