You have to register your service with the service control manager SCM(services.exe) in windows.
For .NET services, this is done with:
-
//INSTALL COMMAND
-
// C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil /i <path and filename of service>
-
//UN-INSTALL COMMAND
-
// C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil /u <path and filename of service>
-
(or similar depending on your .NET package I suppose)
I however have not seen anything in InstallUtil, nor the
System.ServiceProcess.ServiceProcessInstaller or
System.ServiceProcess.ServiceInstaller classes that allow for parameters.
http://msdn.microsoft.com/en-us/libr...e.onstart.aspx
Process initialization arguments for the service in the OnStart method, not in the Main method. The arguments in the args parameter array can be set manually in the properties window for the service in the Services console. The arguments entered in the console are not saved; they are passed to the service on a one-time basis when the service is started from the control panel. Arguments that must be present when the service is automatically started can be placed in the ImagePath string value for the service's registry key (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi ces\<service name>). You can obtain the arguments from the registry using the GetCommandLineArgs method, for example: string[] imagePathArgs = Environment.GetCommandLineArgs();.
From what I have read, the default servicetype does not allow parameters(my service has the parameters box grayed out in the services.msc settings)
This talks about a FileHandlingWinService type:
http://support.microsoft.com/?kbid=829483