这个话题之前已经被讨论过数百万次了,但让我澄清一下我的需求:
我需要一台控制系统并包含必要功能的服务器。此外,将有“n”个客户端,其仅代表HI/GUI并调用服务器端功能。服务器本身应该能够将数据发送回客户端并调用客户端功能(如关闭、退出等...)
我听说过双工服务/合同(http://msdn.microsoft.com /en-us/library/ms731064.aspx),但我不确定我能走多远。
你会如何处理这个问题?
This topic has been discussed million times before, but let me clarify my needs:
I need a single server which controls a system and includes the necessary functions. Furthermore, there will be "n" Clients which represents only the HI/GUI and call server side functions. The server itself should be able to send data back to the clients and call client-side functions too (like shutdown, exit and so on...)
I have heard about duplex services/contracts (http://msdn.microsoft.com/en-us/library/ms731064.aspx), but I'm not sure how far I'll come with that.
How would you handle this?
发布评论
评论(2)
我最近制作了一个概念验证应用程序,使服务器和客户端各托管一个 WCF 服务。客户端连接到服务器,然后在握手调用中向服务器提供连接信息,以允许服务器创建返回客户端的单独连接。它可以同时处理从本地 LAN 到远程站点 64k 线路的网络链接上的多个客户端。
I recently made a proof of concept app that made both the server and the client host a WCF service each. The client connects to the server and then in a handshake call, gives the server the connection information to allow the server create a separate connection back to the client. It worked a treat with multiple clients on network links from local lan to 64k line on remote sites at the same time.
您可以使用 WCF,并将服务托管在 IIS 中的服务器上、客户端的应用程序中,并让客户端在服务器上注册其端点。
You could use WCF, and host the service on the server in IIS, in the application on the client and let the client register it's endpoint on the server.