Service Recovery Mode

  • Thread starter Thread starter Tal
  • Start date Start date
T

Tal

Hi,
I am using ServiceInstaller in order to install a .Net C# service.
How can i configure the service recovery mode using the installer code.
I saw that ServiceInstaller contain many properties like StartType, but i
didn't find any property on recovery issue.
 
You probably have an answer for this by now but here it is anyways...

The following is code to support two things. Adding a description for
the service and setting the recovery properties. This method is for
the serviceInstaller1. Please keep in mind that after you service
installs, reopen the Services window to see your changes. Good luck
!!!

private void serviceInstaller1_AfterInstall(object sender,
System.Configuration.Install.InstallEventArgs e)
{
string strPath = @"System\CurrentControlSet\Services\Service1";
string strDesc = "Does Service1 stuff.";

//Write to the registry...
Registry.WriteValue(strPath, "Description", strDesc);

byte [] bytValue = {0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,79,0,32,0,1,0,0,0,96,234,0,0,1,0,0,0,96,234,0,0,1,0,0,0,96,234,0,0};

Registry.WriteValue(strPath, "FailureActions", bytValue);
}
 
Back
Top