简体   繁体   English

Windows服务和桌面应用之间的通信

[英]Communication between windows service and desktop app

I want to create a communication between a windows service and a desktop application on Windows 7. I read that named pipes are one way for communication between two processes. 我想在Windows 7上创建Windows服务和桌面应用程序之间的通信。我读到命名管道是两个进程之间通信的一种方式。 Can i use them for my purpose? 我可以将它们用于我的目的吗?

sure you can use named pipes, WCF many other IPC methods. 确定你可以使用命名管道,WCF许多其他IPC方法。

for named pipe example among stack overflow questions, see here as well for some backgound: 对于堆栈溢出问题中的命名管道示例,请参阅此处以及某些背景:

Inter process communication using Windows service 使用Windows服务的进程间通信

also check this one: GUI and windows service communication 还要检查一下: GUI和Windows服务通信

As indicated above, there are lots of options available. 如上所述,有很多选择。 Just be aware that if you go the TCP/IP route (eg WCF), the user will have to have a valid network connection (a loopback adapter will work) otherwise your client and service won't be able to communicate. 请注意,如果您使用TCP / IP路由(例如WCF),则用户必须具有有效的网络连接(环回适配器才能工作),否则您的客户端和服务将无法通信。

WCF一起使用 ,这是一个很好的解决方案。

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

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