protected override void OnStart(string[] args) { var serviceHostFactory = new BrightstarServiceHostFactory(); var service = new BrightstarNodeService(); _serviceHost = serviceHostFactory.CreateServiceHost(service, Program.StopNode); _serviceHost.Open(); }
public static void StartService() { WriteWelcomeHeader(); #if DEBUG Logging.EnableConsoleOutput(true); #else Logging.EnableConsoleOutput(false); #endif Logging.LogInfo("Logging started"); Logging.LogInfo("Starting Brightstar server"); try { var serviceHostFactory = new BrightstarServiceHostFactory(); var serviceHost = serviceHostFactory.CreateServiceHost(); serviceHost.Open(); Logging.LogInfo("Brightstar server started"); Console.ReadLine(); } catch (AddressAccessDeniedException ex) { Logging.LogError(BrightstarEventId.AddressAccessDenied, "You do not have the privileges required to register the Brightstar service: " + ex.Message); } catch (Exception ex) { Logging.LogError(BrightstarEventId.ServiceHostStartupFailed, "Error registering or starting Brightstar service: " + ex.Message); } }
private static void StartServer() { lock (HostLock) { try { #if SDK_TESTS // We assume that the test framework starts up the service for us. #else if (_serviceHost == null || _closed) { var serviceHostFactory = new BrightstarServiceHostFactory(); _serviceHost = serviceHostFactory.CreateServiceHost(); _serviceHost.Open(); _serviceHost.Closed += HandleServiceClosed; _serviceHost.Faulted += HandleServiceFaulted; while (!_closed) { Thread.Sleep(1000); } } #endif } catch (AddressAlreadyInUseException) { Console.WriteLine("Server address already in use. Assuming this is OK."); } } }
private static void StartServer() { var serviceHostFactory = new BrightstarServiceHostFactory(); _serviceHost = serviceHostFactory.CreateServiceHost(); _serviceHost.Open(); _serviceHost.Closed += HandleServiceClosed; _serviceHost.Faulted += HandleServiceFaulted; while(!_closed) { Thread.Sleep(1000); } }