public override void Uninstall(IDictionary state) { base.Uninstall(state); try { PolicyManager.Unregister(); } catch { } }
public override void Rollback(IDictionary state) { base.Rollback(state); if (state.Contains(RegisteredWithWMI)) { try { PolicyManager.Unregister(); } catch { } } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { SipStringManager.CreateResourceManager("EnhancedAllowList"); AppEventLog appEventLog = new AppEventLog(Config.ServiceName, "Application"); Config.AppEventLog = appEventLog; #if VSDEBUG // // Registration/Unregistration code for stand alone exe. // Service process reg/unreg will be done at install/uninstall time. // if (args.Length > 0) { string firstArg = args[0].ToLower(); if (firstArg == "/register") { PolicyManager.Register(); } else if (firstArg == "/unregister") { PolicyManager.Unregister(); } else { Console.WriteLine("Unknown argument - {0}", firstArg); } return; } ConsoleApp app = new ConsoleApp(); app.Start(); MessageBox.Show("Hit OK to exit ... ", "EAL Server"); app.Stop(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new ServiceMain() }; ServiceBase.Run(ServicesToRun); #endif }