Exemple #1
0
        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.");
                }
            }
        }
Exemple #3
0
        protected override void OnStart(string[] args)
        {
            var serviceHostFactory = new BrightstarServiceHostFactory();
            var service            = new BrightstarNodeService();

            _serviceHost = serviceHostFactory.CreateServiceHost(service, Program.StopNode);
            _serviceHost.Open();
        }
        private static void StartServer()
        {
            var serviceHostFactory = new BrightstarServiceHostFactory();

            _serviceHost = serviceHostFactory.CreateServiceHost();
            _serviceHost.Open();
            _serviceHost.Closed  += HandleServiceClosed;
            _serviceHost.Faulted += HandleServiceFaulted;
            while (!_closed)
            {
                Thread.Sleep(1000);
            }
        }
Exemple #5
0
 protected override void OnStart(string[] args)
 {
     try
     {
         Logging.LogInfo("Logging started");
         Logging.LogInfo("Starting Brightstar service.");
         var serviceHostFactory = new BrightstarServiceHostFactory();
         _serviceHost = serviceHostFactory.CreateServiceHost();
         _serviceHost.Open();
         Logging.LogInfo("Brightstar service started.");
         TryLog("Brightstar service started.");
     }
     catch (Exception ex)
     {
         Logging.LogError(BrightstarEventId.ServiceStartupFailed, "Service startup failed. Cause: {0}", ex);
         TryLog("Brightstar service failed to start. Cause: " + ex, EventLogEntryType.Error);
         Stop();
     }
 }