/// <summary> /// The main entry point for the application. /// </summary> static void Main(String[] args) { if (Environment.UserInteractive) { if (args != null && args.Length == 1 && args[0].StartsWith("-i", StringComparison.OrdinalIgnoreCase)) { Configuration.Installer.Install(Assembly.GetExecutingAssembly().Location); return; } if (args != null && args.Length == 1 && args[0].StartsWith("-u", StringComparison.OrdinalIgnoreCase)) { Configuration.Installer.Uninstall(Assembly.GetExecutingAssembly().Location); return; } Console.WriteLine("[i] Starting TcmCDService"); using (Service service = new Service()) { using (ServiceHost serviceHost = new ServiceHost(service)) { Logger.Info("TcmCDService starting..."); serviceHost.Open(); serviceHost.PrintEndpoints(); Console.WriteLine("\n[i] Press any key to exit."); Console.ReadKey(); Logger.Info("TcmCDService stopping..."); serviceHost.Close(); } } } else ServiceBase.Run(new WindowsService()); }
/// <summary> /// Initializes a new instance of the <see cref="WindowsService"/> class. /// </summary> public WindowsService() { InitializeComponent(); mService = new Service(); mServiceHost = new ServiceHost(mService); }