I'm very new at programming and coding and I've been asked to install a service multiple times and for them to have different config files. Here's the thing:
- I need to install the same service twice with different names
- Each service has to read a different config file
On the config files I have connection settings that need to be different for both services. The service just retrieves information from another controller, but they need to recieve information from two different controllers and that's why they have asked to have two different instances of the same service with different config files.
I'm stucked with this. I know that both of the services have to have different names. But how can I install them with Inno setup and have them read two different config files?
The service was made with #C, .NET Framework 4.5.2
I have the simple installer for 1 instance:
[Files]
Source: "C:\...\Service.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\...\log4net.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:...\Service.exe.config"; DestDir: "{app}"; Flags: ignoreversion
[Run]
Filename: {sys}\sc.exe; \
Parameters: "create Service start= auto binPath= ""{app}\Service.exe"""; \
Flags: runhidden
[UninstallRun]
Filename: {sys}\sc.exe; Parameters: "stop Service"; Flags: runhidden
Filename: {sys}\sc.exe; Parameters: "delete Service"; Flags: runhidden
It's a very simple service. I know how to add Components
with checkboxes to make the user choose how many instances they want. But I don't know how to add a second instance and how make the second instance read the second config file.
Is there something that I need to change in my service code? Is this at all possible?
I'm sorry for my poor english and if I coudn't explain myself better. I know pretty much nothing about coding and services. Thanks for your help!