how to install multiple instance of same windows service

前端 未结 5 648
囚心锁ツ
囚心锁ツ 2021-02-08 07:42

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.codeprojec

相关标签:
5条回答
  • 2021-02-08 08:09

    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

    0 讨论(0)
  • 2021-02-08 08:12

    Run the asp.net command prompt as administrator and then use the command - installutil "c:\abc\xyz.exe".

    If your service is already install then you can uninstall first using the command - installutil \u "c:\abc\xyz.exe"

    0 讨论(0)
  • 2021-02-08 08:22

    I had to change the service name in the file "ProjectInstaller.Designer.cs" in visual studio and recompile. Hope it helps.

    0 讨论(0)
  • 2021-02-08 08:33
    sc create MyService binPath= "MyService.exe" DisplayName= "MyService"  
    sc description MyService "My description"
    

    Reference: http://support.microsoft.com/kb/251192

    Followed marked answer and wasted an hour. it was simple using sc create command

    0 讨论(0)
  • 2021-02-08 08:36

    You need to copy your service executable to a separate directory and use InstallUtil.exe to give it a different service name.

    It sounds like you missed this section in the linked article

    From a command prompt, you'll need to use InstallUtil to install both instances of your service. For instructions on how to use InstallUtil, see Installer Tool (InstallUtil.exe). Once you're done installing the service instances, you'll have something like the services console above where Service Instance 1 and Service Instance 2 are created from the same executable, only installed from different directory locations with a different service name.

    0 讨论(0)
提交回复
热议问题