static void Main(string[] args) { var isDebug = false; if (isDebug) { ServiceBoot.StartAsync().Wait(); Console.WriteLine("服务启动"); Console.ReadLine(); ServiceBoot.StopAsync().Wait(); } else { ServiceBase.Run(new HostService()); } }
protected override void OnStop() { ServiceBoot.StopAsync().Wait(); }
protected override void OnStart(string[] args) { ServiceBoot.StartAsync().Wait(); }