简体   繁体   English

WCF,Windows服务-需要通知客户端应用程序

[英]WCF, Windows service - needs to notify client application

I am a newbie developer to WCF and Windows services. 我是WCF和Windows服务的新手开发人员。 I do know c#. 我知道C#。 The scenario requires various custom applications running on Windows 7 to call methods in another application. 该方案需要在Windows 7上运行的各种自定义应用程序来调用另一个应用程序中的方法。 It is a client/server relationship, all running on the same computer. 这是一个客户端/服务器关系,所有运行在同一台计算机上。 The server must be able to notify each client (one at a time) when a specified condition occurs. 当指定情况发生时,服务器必须能够通知每个客户端(一次通知一个)。

I need to develop the server code only. 我只需要开发服务器代码。

Would the following be an acceptable solution: 以下是可接受的解决方案:

Make the server a windows service that uses WCF. 使服务器成为使用WCF的Windows服务。 The server could notify the clients by using a different named pipe for each client ? 服务器可以通过为每个客户端使用不同的命名管道来通知客户端?

Thank you...any suggestions would be appreciated. 谢谢...任何建议将不胜感激。

Just use duplex communication over tcp/named pipes/msmq/http (WSDualHttpBinding) channel. 只需通过tcp /命名管道/ msmq / http(WSDualHttpBinding)通道使用双工通信。 AFAIK you need two ports (in/out) for duplex over http AFAIK您需要两个端口(输入/输出)以通过HTTP进行双工

I would ditch wcf altogether. 我会完全放弃wcf。 Although as Brian says, you can use the duplex bindings, these are complicated at best. 尽管正如Brian所说,您可以使用双工绑定,但这些充其量是复杂的。

If it's all going to run on the same computer, why do you even need client/server? 如果所有这些都将在同一台计算机上运行,​​那么为什么您甚至需要客户端/服务器? Just build a single client which does everything you need. 只需建立一个可以满足您所有需求的客户即可。

That is a acceptable solution and should work fine. 那是一个可以接受的解决方案,应该可以正常工作。

Other option for consideration (in the spirit of learning) is creating a Routing Service as an intermediary service which spawns the calls to multiple services. 考虑的另一种选择(本着学习的精神)是将路由服务创建为中介服务,从而产生对多个服务的呼叫。 So in your scenario, your client would call the routing service and the routing service will in turn call each of your service 因此,在您的方案中,您的客户端将调用路由服务,而路由服务将依次调用您的每个服务

The following link should provide more information on routing service... 以下链接应提供有关路由服务的更多信息...

[Routing Service][1] [路由服务] [1]

http://msdn.microsoft.com/en-us/library/ee517423.aspx http://msdn.microsoft.com/en-us/library/ee517423.aspx

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

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