开发者

How to set a connection just for server callbacks and a connection just for client calls using WCF ?

I don't think I was clear. What I meant was How to set a callback("server to client") in a different connection from a "client to server" connection using WCF ?

I always saw callbacks examples using just one DuplexChannelFactory. This implies using only one TCP connection to make client to server calls and receive server to client callbacks.

This question came to me after I read this this topic: Seeking WCF Duplex "TwoWay" Subsc开发者_StackOverflow中文版ribe+Callback Example

I the top answer, Ian Ringrose said:

Some rules I found to help avoid deadlocks. (Look at my WCF questions to see the pain I had!)

The sever must never call out to a client on the same connection as a call from the same client is in process on.

And/or

The client must never call back to the server on the same connection as is used for the “callbacks” while processing a call-back.

And I was wondering how to implement it using WCF.


This CodeProject on Robust Interapplication Communications using Double-Simplex WCF answers exactly your question:

What I decided to do was run two separate WCF connections (double simplex). Each application would run a WCF Host for incoming messages and each application would run a WCF Client for outgoing messages. This is a pretty robust solution and will not be broken by stopping and starting the applications. The WCF Client simply re-establishes the connection if needed.

The way it is solved meets the requirements you have extracted from the Ian Ringrose answer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜