How to create multiple instance of Windows Service?
.net, windows-services
Solution
A service "installation" is really just adding a mapping between a name, an executable, and a few other bits of metadata. A service, once installed, is either running (once), or it isn't. To have multiple instances running as services, they would have to be registered with different names, which basically means installing it multiple times. That does not, however, mean that you need multiple different copies of the executable.
The way I do it is to subclass `Installer` such that it creates a `ServiceInstaller` and `ServiceProcessInstaller`, and gives a `ServiceName` (at runtime, via the custom installer) to the `ServiceInstaller` instance, then use `ManagedInstallerClass` at runtime - basically making a standalone exe capable of installing and uninstalling itself as a service (as many times as you like), using command-line parameters to specify the name.
Problem
I want to run multiple instances of a Windows Service installed on a server without installing it again. How is this possible?