简体   繁体   English

wcf和双工通信

[英]wcf and duplex communication

I have a lot of client programs and one service. 我有很多客户端程序和一项服务。 This Client programs communicate with the server with http channel with WCF. 此客户端程序通过WCF通过http通道与服务器通信。

The clients have dynamic IP. 客户端具有动态IP。 They are online 24h/day. 他们每天24小时在线。

I need the following: The server should notify all the clients in 3 min interval. 我需要以下内容:服务器应在3分钟的间隔内通知所有客户端。 If the client is new (started in the moment), is should notify it immediately. 如果客户端是新客户端(此刻开始),则应立即通知它。

But because the clients have dynamic IP and they are working 24h/day and sometimes the connection is unstable, is it good idea to use wcf duplex? 但是由于客户端具有动态IP,并且他们每天24小时工作,有时连接不稳定,所以使用wcf双工是个好主意吗?

What happens when the connection goes down? 连接断开时会发生什么? Will it automatically recover? 它会自动恢复吗?

Is is good idea to use remote MSMQ for this type of notification ? 将远程MSMQ用于此类通知是个好主意吗?

Regards, 问候,

WCF duplex is very resource hungry and per rule of thumb you should not use more than 10. There is a lot of overhead involved with duplex channels. WCF双工非常耗费资源,根据经验,双工通道的开销不应该超过10。 Also there is not auto-recover. 也没有自动恢复。

If you know the interval of 3 minutes and you want the client to get information when it starts why not let the client poll the information from the server? 如果您知道3分钟的间隔,并且希望客户端在启动时获取信息,为什么不让客户端从服务器轮询信息呢?

When the connection goes down the callback will throw an exception and the channel will close. 当连接断开时,回调将引发异常,并且通道将关闭。

I am not sure MSMQ will work for you unless each client will create an MSMQ queue for you and you push messages to each one of them. 我不确定MSMQ是否会为您工作,除非每个客户端都会为您创建一个MSMQ队列,然后您将消息推送到每个客户端。 Again with an unreliable connection it will not help. 同样,如果连接不可靠,将无济于事。 I don't think you can "push" the data if you loose the connection to a client, client goes off-line or changes an IP without notifying your system. 如果您断开与客户端的连接,客户端脱机或更改IP而没有通知您的系统,我认为您无法“推送”数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM