我的问题与以下问题基本相同,但答案对我没有帮助.
My question is essentially the same as the following one but the answer did not help me.
.NET Windows 服务 - 一个项目中的多个服务
基本上,我有 3 个服务,比如说Service1"、Service"和Service3".
Essentially, I have 3 services, lets say "Service1", "Service" and "Service3".
ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1("Service1"), new Service2("Service2"), new Service3("Service3") }; ServiceBase.Run(ServicesToRun);我也有相应的安装程序类serviceInstaller.ServiceName = "ServiceX" 用于这些服务中的每一个.
I also have installer classes with corresponding serviceInstaller.ServiceName = "ServiceX" for each of these services.
当我使用 installutil 时,我确实在服务管理器上看到了所有 3 个服务.但是,当我启动它们(其中任何一个或全部)时,只有第一个(Service1")正在运行.
When I use installutil, i do see all 3 services on the Service manager. However, when i start them (any or all of them) only the first one ("Service1") is running.
我知道这是微不足道的,我可能可以为每个安装程序使用不同的安装程序项目,但就我而言,仅使用一个在语义上更有意义
I know this is trivial and i can probably have different installer projects for each of these but in my case, it semantically makes more sense to use just one
感谢您的帮助
谢谢维努
推荐答案我创建了一个 3 服务项目(如下),它为每个服务使用一个项目安装程序.然后我添加了一个安装程序项目,将服务安装到服务管理器中.这是我的工作流程:
I created a 3 service project (below) which uses a project installer for each service. I then added an installer project which installs the services into service manager. Here was my workflow:
这在服务管理器中为我提供了三个不同的服务:Service1、Service2 和 Service3
This gives me three distinct services in service manager: Service1, Service2 and Service3
code.google/p/multi-service-install/
我已将存储库中的代码更新为具有一个可执行文件和两个服务.每个服务都以自己的名称和启动/停止能力安装到服务管理器.我想这就是你想要的,对吗?这是我所做的:
I have updated the code in the repository to have one executable but two services. Each service installs to the service manager with its own name and ability to start/stop. I think this is what you're wanting, correct? Here is what I did:
代码仍然可以从与上面相同的链接下载.
The code can still be downloaded from the same link as above.
谢谢!
更多推荐
我可以在单个 Windows 可执行文件中托管多个服务吗
发布评论