开发者

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

开发者 https://www.devze.com 2022-12-22 23:10 出处:网络
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.

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

精彩评论

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

关注公众号