Wednesday 15 February 2012


Yesterday I had to find a way to host multiple instances of the same application as a different windows services in the same server. In order to achieve this, the quickest and easiest method is to make use of  "sc create" command. SC command allows to create a windows service even on remote computer. You can see documentation here.

You need to run "Command Prompt" as "Administrator" to execute your command.

Imagine you developed a windows service application. Now all that needs to be done is create multiple copies of the folder containing necessary assemblies or binaries. For example if you need to have 3 instances of the same application running as 3 different windows service then you need to create 3 different folders containing the same executables/assemblies.

Now we just need to execute following command -

> sc create ServiceInstance1 binPath= "location of the exe"
> sc create ServiceInstance2 binPath= "location of the exe"
> sc create ServiceInstance3 binPath= "location of the exe"

After successfully executing above commands, we should see 3 new windows services of the same application registered.

Thanks,
Milan Gurung