Exemplo n.º 1
0
        public void HandleStarted()
        {
            try
            {
                _healthNotifier.Notify("Initializing");

                _startupManager.StartAsync().GetAwaiter().GetResult();

                _healthNotifier.Notify("Application is started");

                if (_hostingEnvironment.IsDevelopment())
                {
                    return;
                }

                if (_monitoringServiceClientSettings?.CurrentValue == null)
                {
                    throw new ApplicationException("MonitoringServiceClient settings is not provided.");
                }

                _configurationRoot
                .RegisterInMonitoringServiceAsync(_monitoringServiceClientSettings.CurrentValue.MonitoringServiceUrl, _healthNotifier)
                .GetAwaiter()
                .GetResult();
            }
            catch (Exception ex)
            {
                _log.Critical(ex);
                throw;
            }
        }
        public async Task HandleStartedAsync()
        {
            try
            {
                _healthNotifier.Notify("Initializing");

                await _startupManager.StartAsync();

                _healthNotifier.Notify("Application is started");

                if (_hostingEnvironment.IsDevelopment())
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                _log.Critical(ex);
                throw;
            }
        }