using System; using System.Diagnostics; using System.ServiceProcess; using System.Windows.Forms; namespace JLHHJSvr { static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { if (Environment.UserInteractive) { // 界面运行 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } else { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new JLHHJSvr(), }; ServiceBase.Run(ServicesToRun); } } } }