using System; using System.Collections.Generic; using System.Linq; using System.ServiceProcess; using System.Text; using System.Configuration.Install; using System.ComponentModel; namespace NetMonitorServer { static class Program { /// /// The main entry point for the application. /// static void Main(string[] args) { if (args.Length == 0) { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); } else if (args.Length == 1 || args[0] == "-r") { Service1 s = new Service1(); s.StartServiceConsole(args); while (true) { System.Threading.Thread.Sleep(100); } } } } [RunInstaller(true)] public class TestWinInstaller : Installer { private ServiceInstaller m_ThisService; private ServiceProcessInstaller m_ThisServiceProcess; public TestWinInstaller() { m_ThisService = new ServiceInstaller(); m_ThisServiceProcess = new ServiceProcessInstaller(); m_ThisServiceProcess.Account = ServiceAccount.LocalSystem; m_ThisService.ServiceName = "NetMonitorServer"; m_ThisService.StartType = ServiceStartMode.Automatic; m_ThisService.Description = "Teil von NetMonitor der die Systemnahen Befele ausführt"; m_ThisService.DisplayName = "Netzwerk Settings Tool"; Installers.Add(m_ThisService); Installers.Add(m_ThisServiceProcess); } } }