public ControllerService() { logger = LogManager.GetLogger("ControllerService"); logger.Info("ControllerService initializing..."); // Read port value int port; if (ConfigurationManager.AppSettings["ControllerPort"] != null) { if (!int.TryParse(ConfigurationManager.AppSettings["ControllerPort"], out port)) { port = DefaultPort; } } else { port = DefaultPort; } // Create server this.server = new ControllerServer(port, logger); this.server.OnClientConnected += this.ServerOnClientConnected; logger.Info("ControllerService initialized."); }