简体   繁体   English

如何将消息发送到已执行的Windows Service C#

[英]How send messages to executed windows service C#

I have developed windows service on C# .Net 4.0. 我已经在C#.Net 4.0上开发了Windows服务。 Can I send command message to executed service to reload config or other custom actons? 我可以向执行的服务发送命令消息以重新加载配置或其他自定义acton吗? In Unix Redhat systems I can use command prompt for it. 在Unix Redhat系统中,我可以使用命令提示符。 How I can do same in Windows Services without restart service? 没有重新启动服务,如何在Windows服务中执行同样的操作?

You can do it by command line with net stop and net start or 您可以通过命令行使用net stop和net start或

Read this C# article on playing with services direct which outlines how to use the "servicecontroller" to do just that. 阅读有关使用直接服务的C#文章 ,其中概述了如何使用“ servicecontroller”来实现这一点。

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

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