开发者

Duplex WCF service channels continuously alive (WSDualHttpBinding)

开发者 https://www.devze.com 2023-03-16 18:31 出处:网络
The arhitecture: console application that contains a wcf duplex service; windows app consumers; every app subscribe to Duplex, so we have a list of subscribers

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

精彩评论

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