从另一个Windows服务调用Windows服务

编程入门 行业动态 更新时间:2024-10-10 13:18:06
本文介绍了从另一个Windows服务调用Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以在C#中从另一个Windows服务调用Windows服务?我创建了两个Windows服务WindowsService1和WindowsService2.我想在WindowsService1中调用WindowsService2,这意味着将一个Windows服务调用到另一个Windows服务.请给我一个解决方案.

Is it possible to call windows service from another windows service in C#? I have created two windows services WindowsService1 and WindowsService2. I want to call WindowsService2 in WindowsService1, means call one windows service to another windows service. Please give me a solution.

推荐答案

是的.请参见 ServiceController类 [ ^ ]-它包含一个示例. Yes. See the ServiceController class[^] - it contains an example.

您不呼叫"服务.您可以控制它(启动,停止,暂停,继续和自定义命令),但是不能调用它. 正如Griff所说的,ServiceController对象就是您要使用的对象. You don''t "call" a service. You can control it (start, stop, pause, resume, and custom commands), but you can''t call it. As Griff has already stated, the ServiceController object is what you want to use.

如果您需要调用另一个服务中的功能,则必须为该服务设置一个消息传递系统,通常是TCP连接. If you need to call the functionality within another service you have to setup a messaging system for that service, usually TCP connections.

更多推荐

从另一个Windows服务调用Windows服务

本文发布于:2023-11-08 20:52:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1570429.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!