多个WCF服务可以相互通信吗?
我刚刚开始 WCF,所以我不明白抽象是如何工作的。我可以编写一个 WCF 服务并在多台计算机上安装相同的东西,并让它们通过某个 ID 进行通信吗?我正在研究发送/接收命令以及设备之间发送的连续实时数据。
I'm just beginning WCF and so I don't understand exactly how the abstraction works. Can I write a WCF service and install the same thing on multiple machines, and have them communicate via some ID? I'm looking at sending/receiving commands, and continuous real-time data being sent between devices.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您编写的任何服务都可以安装在任意数量的计算机上 - 没有问题。
任何机器或你在这些机器上运行的代码也可以同时充当客户端,调用其他服务,是的,绝对的,这是完全可能的。
您需要将服务契约定义为接口,并在该服务契约中描述操作(服务方法)。部署该服务后,任何人都可以充当该服务的客户端并向其发送消息。
当然,您可以拥有一个同时存在的应用程序(ASP.NET、Winforms 等)——它提供服务,但也充当其他服务的客户端。
希望能有所帮助!
Any service you write can be installed on any number of machines - no problem there.
Any machine or code you run on those machines can also act as a client at the same time, calling other services, yes, absolutely, that's totally possible.
You need to define your service contract as an interface and in that service contract you describe the operations (service methods). Once that service is deployed, anyone can act as a client to that service and send it messages.
And of course, you can have an app (ASP.NET, Winforms whatever) that is both simultaneously - it offers services, but also acts as a client to other services.
Hope that helps a bit!