I cannot figure out how to pass (constant) arguments into my Windows service when it is started. I'm using the standard .NET classes like ServiceBase to implement (and ServiceProcessInstaller and ServiceInstaller to install) my service.
On the general tab of a Windows Service properties dialog box (once installed), there's a "Path to executable" in which I can see that some of the standard Windows services have command line arguments specified. System.ServiceProcess.ServiceBase.OnStart
takes string[] args
, which I presume would enable these arguments to be accessed from within .NET code.
Are there some properties on ServiceProcessInstaller or ServiceInstaller that I can set to allow me to pass startup arguments to my own service, or does anyone know how it's supposed to be done?