static void Main(string[] args) { var appPath = Application.StartupPath + "/"; var configLogingFileName = appPath + "Settings/Logging.xml"; XmlConfigurator.Configure(new FileInfo(configLogingFileName)); if (args.Length > 0 && args[0].ToLower().Equals("console")) { using (controller = new GCSService(netConfiguration)) { controller.OpenService(); Console.WriteLine("Сервис запущен. Нажмите Enter для остановки."); Console.ReadLine(); controller.CloseService(); } } else { ServiceBase.Run(new Program()); } }
static void Main(string[] args) { var configLogingFileName = "Settings\\Logging.xml"; XmlConfigurator.Configure(new FileInfo(configLogingFileName)); var netConfiguration = new NetConfigurationImpl { //ServerHost = "192.168.1.66", ServerHost = "localhost", ServerPort = 9876 }; using (var controller = new GCSService(netConfiguration)) { controller.OpenService(); Console.WriteLine("Сервис запущен. Нажмите Enter для остановки."); Console.ReadLine(); controller.CloseService(); } }
protected override void OnStart(string[] args) { controller = new GCSService(netConfiguration); controller.OpenService(); }