如何保存(序列化)当前连接到WCF服务的客户端? [英] How can I save (serialize) the clients currently connected to a WCF service?

查看:119
本文介绍了如何保存(序列化)当前连接到WCF服务的客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我的问题是这样的:



如何保存客户当前连接到WCF服务,以便服务可以在重新启动后加载它们吗?



我当前的场景如下:

我有以发布/订阅方式连接到服务的客户端。该服务保留一个存储客户端回调的内部列表,因此服务器可以在任何给定时间与它们通信。

客户不会经常更改。大约一个月后,会添加一个新客户端或删除一个新客户端。他们每次都在线。



我现在希望能够与所有客户端序列化回调列表,因此我可以在服务重新启动后加载它们。通过这种方式,服务可以与客户交谈而无需再次订阅。



一些顽强

- 我想避免任何客户端轮询(例如定期启动方法,以便客户端在服务重新启动后再次连接)

- 我不希望在服务端手动配置客户端。 br />
- 也许有一些方法可以在不使用回调的情况下从调用客户端读取/保存连接凭据。然后我可以正常方式连接....







提前感谢您的帮助



祝你好运



immes

解决方案

< blockquote>我怀疑这项工作。如果您保存代理会发生什么,但客户端应用程序关闭,可能是因为您的服务没有响应?现在你已经回复了一个不再存在的客户端。什么呢?






这没问题。发生这种情况时,我将从列表中删除客户端。

他以后可以再次联系。

关于整个过程,这是完全可以接受的。


Dear All,

my Question goes like this:

How can I save the clients that are currently connected to a WCF service, so that the service can load them after it has been restarted?

My current Scenario is as follows:
I have clients that connect to a Service in a Publish /Subscribe way. The service keeps an internal list that stores the Client Callbacks, so the server can communicate with them at any given time.
The Clients do not change very often. Once a month or so a new Client gets added or one gets removed. They are online every time.

I would now like to be able to serialize the callbacklist with all the clients, so I can load them after the service has been restarted. This way the service could talk to the clients without having them to subscribe again.

Some toughts
- I''d like to avoid any client polling (e.g. firing up a method periodically so a client gets connected again after the service has been restarted)
- I don''t want the Clients to be manually configured on the services side.
- Maybe there is some way to read/save the connection credentials from a calling client without using callbacks. Then I could connect in a normal way....



Thanks in advance for your help

Best regards

immes

解决方案

I have my doubts about this working. What happens if you save the delegate, but the client app closes, possibly because your service isn''t responding?? Now you''ve got a callback to a client that doesn''t exist any more. What then??


Hi,

that is no Problem. When this happens I will delete the client from the list.
He can connect again later.
Regarding the overall process this is fully acceptable.


这篇关于如何保存(序列化)当前连接到WCF服务的客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆