I am using this method to create a windows service.
public void InstallService(string username, string password, string configurationUser, string configurationPassword)
{
var installationPath = GetInstallationPath();
var process = installationPath + @"myservice.exe ";
args = "-install " + username + " " + password;
InstallProcessWithLogOn(process, args, username, password, configurationUser, configurationPassword, 90 * 1000);
// InstallProcessWithLogOn uses the method CreateProcessWithLogonW
}
As default, my service, in the Recovery tab, has "Take no action" at First failure, Second failure and Third failure.
How can I modify my method such that when the service is created it has the option set as "Restart the Service" for First failure, Second failure and Third failure?
LE : Is there any way of configuring that service using advapi32.dll's method CreateProcessWithLogonW? Or something else from advapi32.dll?