How to pass arguments to installutil MyService.exe Parameter1 Parameter2
I MyService is a windows service. I want to pass the arguments to this service.
override the install method of ProjectInstaller class
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string lParam1 = Convert.ToString(GetParam("Param1"));
}
private object GetParam(string p)
{
try
{
if (this.Context != null)
{
if (this.Context.Parameters != null)
{
string lParamValue = this.Context.Parameters[p];
if (lParamValue != null)
return lParamValue;
}
}
}
catch (Exception ex )
{
}
return string.Empty;
}
and install the service using installutil /Param1=value path_to_your_exename