Is it possible to install multiple instances of the same delphi service application?
You haven't made it clear what you have tried to change in the TService subclass.
Have you added a "BeforeInstall" handler?
Something like:
procedure TServiceMain.ServiceLoadInfo(Sender : TObject);// new method, not an override
begin
Name := ParamStr(2);
DisplayName := ParamStr(3);
end;
procedure TServiceMain.ServiceBeforeInstall(Sender: TService);
begin
ServiceLoadInfo(Self);
end;
procedure TServiceMain.ServiceCreate(Sender: TObject);
begin
ServiceLoadInfo(Self);
end;
If you do this regularly, subclass TService to do thie in the Constructor instead.
You should do the same in the BeforeUninstall as well - point both events at the same method.
C:\>servicename /install MyService "My Service Description"
You can create your service with multiple threads internally, each one acting like it's own version/copy of the service. You control it with the Service Controller API, IIRC.
Well yes it is possible to install multiple instances of the same service, you simply need to dynamically alter the name at install time (not runtime) however this does not make it desireable. (there is some sample code on Code project http://www.codeproject.com/KB/dotnet/MultipleInstNetWinService.aspx)
I would however be inclined to rethink your approach, service processes themselves are really meant to be singleton, if you need multiple instances of a process being run, maybe your service should just control and manage the multiple processes rather than being the process.