using System.ServiceProcess; namespace SSWMS.Service { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { ExitCode = Program.Start(); if (ExitCode > 0) { Stop(); } } protected override void OnStop() { Program.Stop(); } } }