Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install multiple instance of same windows service

I created one windows serives

It gets the name of the service from web config file.

I used the below link for getting value from webconfig. http://www.codeproject.com/KB/dotnet/MultipleInstNetWinService.aspx

for installing my windows service,i just click the icon and install again, i change the value in config file and rebulid my application.

again i try to install, it shows error like the specified service already exist.

How to install multiple instance of same windows service?

Thanks, Pooja

like image 889
Pooja Avatar asked Jan 04 '12 10:01

Pooja


People also ask

How do I install multiple instances of Windows service?

Using SC.exe 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.

Can two Windows services have the same name?

Answer. No, you should not have 2 services with the same name. It is mentioned in the Service Configuration Guide that service names should be unique. It it may be possible to create 2 services with the same name, but this can lead to problems in the future and is not a supported configuration.

Can we host a single executable with two different service name?

You can use the same .exe for multiple entries in the "Services" table, as long as the "Service Name" in the list is unique.


1 Answers

I needed to do this for a quick demo of a service running with different parameters.

I copied the directory containing the service exe and then used the sc create command to setup the second service.

sc create "[NewServiceName]" binPath="[PathToCopiedServiceDirectory]"

How to create a windows service using the Sc.exe command

like image 198
Naeem Sarfraz Avatar answered Sep 30 '22 17:09

Naeem Sarfraz