带有WPF管理工具的Windows服务
我正在尝试在 .net 中使用 C# 创建一个 Windows 服务,该服务在用户登录之前运行... 然后,当用户登录时,系统托盘中(时钟旁边)应出现一个符号,以向用户显示该服务正在运行。 通过双击该符号,应该向用户显示一个配置实用程序(用 wpf 编写),以便他可以配置服务、从中读取数据等等。
是否有可能在一个应用程序中执行此操作?
预先感谢您的帮助!
i'm trying to create a windows service with C# in .net that runs before the user is logged on...
then when a user is logged on a symbol should appear in the system tray (next to the clock) to show the user that the service is running..
by double clicking that symbol a configuration utility (written in wpf) should be shown to the user, so he can configure the service, read data from it and so on ..
is there a possibility to do this within one application?
thanks in advance for any help!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,您无法对一个应用程序执行此操作,因为服务在不同的会话中与不同的用户一起运行。您需要创建两个应用程序并在两者之间实现一些通信。
我不建议直接使用命名管道(例如 Kieren Johnstone 建议),但是看看 WCF,它是为进程间通信而设计的,并且很好地抽象了通信技术的实现细节。下面是一个可以帮助您使用 WCF 的链接: http:// www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication。
最好的问候,
奥利弗·哈纳皮
No, you can't do this with one application as services run with a different user in a different session. You need to create two applications and implement some communication between both.
I would not recommend using named pipes directly (like Kieren Johnstone suggested), but to have a look at WCF which was designed for interprocess communication and nicely abstracts implementation details of the communication technology away from you. Here is a link that can propably help you with WCF: http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication.
Best Regards,
Oliver Hanappi
在一份申请中,没有。服务在会话0中运行,请参见此处:
您最好的选择是使用命名管道,请参见此处:
....或内存映射文件,请参见此处:
在more-.NETty的范围内,您还可以使用Remoting。您需要提供一些接口或协议来促进服务和管理实用程序之间的通信。管理进程启动/停止会更容易,您可以使用
ServiceController
类 (MSDN 参考)。希望这会有所帮助(而且不会太令人沮丧)!
Within one application, no. Services run in session 0, please see here:
Your best bet is to used Named Pipes, see here:
....or a memory mapped file, see here:
Within the scope of more-.NETty, you could also use Remoting. You'll need to come up with some interface or protocol to facilitate communication between the service and the management utility. Managing the process start/stop would be easier and you could use the
ServiceController
class (MSDN ref).Hope that helps (and itsn't too discouraging)!