开发者

Duplex WCF service channels continuously alive (WSDualHttpBinding)

The arhitecture:

  1. console application that contains a wcf duplex service;
  2. windows app consumers; every app subscribe to Duplex, so we have a list of subscribers and the service must send notifications to some of them in case that some events apper;

The problem:

  1. how to maintain the connection alive continuously so that the service can send notifications to clients ?

I found t开发者_JS百科hat there are 2 channels for this binding. I need to have permanently the channel from service (for callbacks) open.

Thanks;


I had the same problem than you, to solve it you need to implement a keep alive method. A dummy call to your service is kind of stupid to have a 24/7 WCF service because is not really the best architecture way of WCF but we know sometimes what we need is not always the best thing.

So yep, just implement a call to the WCF service every 5 minutes and by doing that you keep alive the connection. Maybe you can have others problems too, in my case I don't have a lot of subscribers of the WCF service so this solution was fine.


As long as a client is connected to the service, the callback channel will be alive. Once the client disconnects (or the channel gets faulted), the callback channel will close.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜