My question is essentially the same as the following one but the answer did not help me.
.NET Windows Service - multiple services in one project
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);
I also have installer classes with corresponding serviceInstaller.ServiceName = "ServiceX" for each of these services.
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
Your help is appreciated
Thanks Venu
In order to add additional instance of a service to the Windows Service dialog box, each service must have a unique name. In order to achieve this you will need to use the Windows SC utility. The SC utility communicates with the Service Controller and installed services.
On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention.
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:
This gives me three distinct services in service manager: Service1, Service2 and Service3
http://code.google.com/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.
Thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With