Home » Getting started » Installing » Installing Multiple Instances of a service
Sometimes on development machine or in production you might need to install the same windows service for different channels or project.
This can be for example the messaging service, FTP, IndexService etc. and this article describes how to do this.
Solution is to use Service Controller to install windows service with custom service name:
sc create ServiceName binPath= "c:\...\Service.exe"
SC makes possible to install multiple services from one or different folders with different names.
Same settings different names
For example we can have the following structure: c:\Mysite\MonitorProduct\MonitorProductService.exe then type in command prompt:
sc create MyFirstSiteMonitorService binPath= " c:\Mysite\MonitorProduct\MonitorProductService.exe”
sc create MySecondSiteMonitorService binPath= " c:\Mysite\MonitorProduct\MonitorProductService.exe”
in Services list you will see two services under the names just created.
Different setting and names
If we instead need to have multiple services with different configurations (DB connection string, monitor frequency and so on)
we can just copy service files to different folders for example:
c:\MyFirstSite\MonitorProduct\MonitorProductService.exe
and
c:\MySecondSite\MonitorProduct\MonitorProductService.exe
then modify settings separately in each folder like this:
sc create MyFirstSiteMonitorService binPath= " c:\MyFirstSite\MonitorProduct\MonitorProductService.exe”
sc create MySecondSiteMonitorService binPath= " c:\MySecondSite\MonitorProduct\MonitorProductService.exe”
so we will have two services with different names, doing the same things but with different settings.