I tried to pass parameters to a windows service.
Here is my code snippet:
class Program : ServiceBase
{
public String UserName { get; set; }
You can pass parameters on startup like this:
If you enter there for example User Password you will get these parameters in protected override void OnStart(string[] args) as args.
then use it like this:
protected override void OnStart(string[] args)
{
base.OnStart(args);
UserName = args[0];
Password = args[1];
//do everything else
}