/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main(string[] args) { #if DEBUG ConsoleHelper.Title = "SAEA.DistributedServices.Host"; DistributedHelper.TansactionServiceInit(); ConsoleHelper.WriteLine("SAEA.DistributedServices 已启动..."); ConsoleHelper.WriteLine("回车结束服务"); ConsoleHelper.ReadLine(); #else if (args.Length != 0) { switch (args[0].ToUpper()) { case "/I": WinService.WinServiceHelper.InstallAndStart(FilePath, Name, Display, Description); return; case "/U": WinService.WinServiceHelper.Unstall(Name); return; default: ConsoleHelper.WriteLine("args:"); ConsoleHelper.WriteLine("\t/i\t\t 安装服务"); ConsoleHelper.WriteLine("\t/u\t\t 卸载服务"); return; } } else { new Service1().Run(); } #endif }
protected override void OnStart(string[] args) { DistributedHelper.TansactionServiceInit(); }