C# Windows Service - allow multiple defined services?

  • Thread starter Thread starter Adam Clauss
  • Start date Start date
A

Adam Clauss

We have a service written in C#. The generated code "hardcodes" the service
name into the exe.

We have a situation where we would like to allow multiple Windows Services
to be defined. These would differ by the command-line parameters passed to
the .exe to give it a different configuration.

Is there a way to do this?
 
Adam Clauss said:
We have a service written in C#. The generated code "hardcodes" the service
name into the exe.

We have a situation where we would like to allow multiple Windows Services
to be defined. These would differ by the command-line parameters passed to
the .exe to give it a different configuration.

Is there a way to do this?


Surely this is a job for the application config file, especially since its a
service?
 
I'm not sure I understand -
I can get the application to RUN once it is installed, my problem is the
actual creation of a Windows service.

Install util does not allow you to specify a "service name" to be used for
Windows, so it always uses what is hardcoded into the .exe. Except you
can't have two services with the same name, so the second installutil will
always fail.
 
Adam Clauss said:
We have a service written in C#. The generated code "hardcodes" the
service name into the exe.

We have a situation where we would like to allow multiple Windows Services
to be defined. These would differ by the command-line parameters passed
to the .exe to give it a different configuration.

Is there a way to do this?

You can install one .Net NT service that has multiple NT services within the
one installed NT Service.
 
Mr. Arnold said:
You can install one .Net NT service that has multiple NT services within
the one installed NT Service.

That's the thing, it isn't that there are multiple services within the .exe
itself. They are all doing the exact same action, just possibly with a
slightly different configuration (as passed by command line parameter).

One deployment of the software might need one instance of this process.
Another deployment might need 2, or even 3, etc.
 
Adam Clauss said:
That's the thing, it isn't that there are multiple services within the
.exe itself. They are all doing the exact same action, just possibly with
a slightly different configuration (as passed by command line parameter).

One deployment of the software might need one instance of this process.
Another deployment might need 2, or even 3, etc.

This may help you. Idon't know. I am going to keep this link myself, as I
may have a need to do this.

<http://www.c-sharpcorner.com/Upload...M/Passing_parameters_to_Windows_Services.aspx>
 
Back
Top