Dev2.WindowsServiceManager.SetRecoveryOptions C# (CSharp) Method

SetRecoveryOptions() private static method

private static SetRecoveryOptions ( ) : void
return void
        private static void SetRecoveryOptions()
        {
            int exitCode;
            using (var process = new Process())
            {
                ProcessStartInfo startInfo = process.StartInfo;
                startInfo.FileName = "sc";
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;

                // tell Windows that the service should restart if it fails
                string arguments = string.Format("failure \"{0}\" reset= 0 actions= restart/60000", "Warewolf Server");
                startInfo.Arguments = arguments;

                process.Start();
                process.WaitForExit();

                exitCode = process.ExitCode;

                process.Close();
            }
            if (exitCode != 0)
            {
                throw new InvalidOperationException();
            }
        }