在单个名称下运行多个Windows服务 [英] Run multiple windows services under a single name

查看:135
本文介绍了在单个名称下运行多个Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我有两种不同用途的Windows服务。我可以将它们作为两个独立的窗口服务运行。



service1

service2



我的要求是使用单个服务名称[Mainservice]运行两个不同的Windows服务。我没有在services.msc中运行两个不同的服务,而是需要在services.msc下运行一个服务。



请告诉我你的建议。



谢谢,

克里斯。



我的尝试:



我尝试过两个独立的服务。

Hello All,

I have two different windows services for different purpose. I am able to run them as two separate windows services.

service1
service2

My requirement is like to run two different windows services with a single service name[Mainservice]. Instead of running two different services in services.msc I need to have a single service running under services.msc.

Please let me know your suggestions.

Thanks,
Chris.

What I have tried:

I have tried with two separate services.

推荐答案

这样做的唯一方法就是将它们组合成一个服务应用程序。



就像理查德在评论中所说,你可以在不同的线程中独立运行它们。



但是说真的,我把它们分成了两个服务。如果一个服务由于某种原因崩溃或失败,你可以停止该服务并让另一个服务运行。



如果你将它们组合成一个服务而另一个服务你的子服务崩溃,你必须停止一切只是为了重新启动失败的那个。
The only way to do that would be to combine them into a single service application.

Like Richard said in his comment, you could run them independent of each other in separate threads.

But seriously, I'd split them into two services. If one service crashes or fails for some reason, you can stop just that service and leave the other one running.

If you combine them into a single service and one of your "sub services" crashes, you have to stop everything just to restart the one that failed.


这篇关于在单个名称下运行多个Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆