Currently, I have a project with a Windows Service. I also created another "Setup Project" which installs the Windows Service.
My question is this: Can I add another Windows Service to the same project? (This way, I can use 1 installer, and share some code between the services more easily.) If I can, does that mean when one service encounters errors then both services are stopped, or do they error out independently of each other?
Are there any other differences between coding 1 service per project, or having multiple services in one project?
yes, you can have multiple services in the same project. Although they both use the same exe, they are loaded into different memory spaces and act independently of each other.
I know this is already answered, but if you'd like an example (code) of how to run two services in the same project please have a look at my answer to a similar question:
Can I have multiple services hosted in a single windows executable.
Thanks!
I am a developer for an open source windows service hosting framework called Daemoniq. Running multiple services in one process is one of its features. You can download it from http://daemoniq.org
Current features include:
- container agnostic service location via the CommonServiceLocator
- set common service properties like serviceName, displayName, description and serviceStartMode via app.config
- run multiple windows services on the same process
- set recovery options via app.config
- set services depended on via app.config
- set service process credentials via command-line
- install, uninstall, debug services via command-line
Thanks!