Пример #1
0
        private async Task StartApplication()
        {
            try
            {
                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

                var monitoringServiceClientSettings =
                    ApplicationContainer.ResolveOptional <MonitoringServiceClientSettings>();

                Program.AppHost.WriteLogs(Environment, Log);

                if (monitoringServiceClientSettings != null &&
                    !string.IsNullOrEmpty(monitoringServiceClientSettings.MonitoringServiceUrl))
                {
                    await AutoRegistrationInMonitoring.RegisterAsync(Configuration,
                                                                     monitoringServiceClientSettings.MonitoringServiceUrl,
                                                                     Log);

                    await Log.WriteMonitorAsync("", "", "Started");
                }
            }
            catch (Exception ex)
            {
                await Log.WriteFatalErrorAsync(nameof(Startup), nameof(StartApplication), "", ex);

                throw;
            }
        }
        private async Task StartApplication()
        {
            try
            {
                // NOTE: Job not yet recieve and process IsAlive requests here

                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

#if azurequeuesub
                _triggerHost = new TriggerHost(new AutofacServiceProvider(ApplicationContainer));

                _triggerHostTask = _triggerHost.Start();
#endif
                await Log.WriteMonitorAsync("", Program.EnvInfo, "Started");

#if (!DEBUG)
                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, Log);
#endif
            }
            catch (Exception ex)
            {
                await Log.WriteFatalErrorAsync(nameof(Startup), nameof(StartApplication), "", ex);

                throw;
            }
        }
        private async Task StartApplication()
        {
            try
            {
                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

                _log.WriteMonitor("", "", "Started");

#if (!DEBUG)
                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, _log);
#endif
            }
            catch (Exception ex)
            {
                _log.WriteFatalError(nameof(Startup), nameof(StartApplication), ex);
                throw;
            }
        }
Пример #4
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime appLifetime)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var appName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;

            appLifetime.ApplicationStarted.Register(() =>
            {
                try
                {
                    _log.WriteMonitor("StartApplication", null, "Application started");

                    if (!env.IsDevelopment())
                    {
                        if (_settings.MonitoringServiceClient?.MonitoringServiceUrl == null)
                        {
                            throw new ApplicationException("Monitoring settings is not provided.");
                        }

                        AutoRegistrationInMonitoring.RegisterAsync(Configuration, _settings.MonitoringServiceClient.MonitoringServiceUrl, _log).GetAwaiter().GetResult();
                    }
                }
                catch (Exception ex)
                {
                    _log.WriteFatalError("StartApplication", "", ex);
                    throw;
                }
            });

            app.UseLykkeMiddleware(appName, ex => ErrorResponse.Create("Technical problem"));
            app.UseLykkeForwardedHeaders();
            app.UseStaticFiles();
            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Пример #5
0
        private async Task StartApplication()
        {
            try
            {
                // NOTE: Job not yet recieve and process IsAlive requests here

                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

                await Log.WriteMonitorAsync("", Program.EnvInfo, "Started");

                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, Log);
            }
            catch (Exception ex)
            {
                await Log.WriteFatalErrorAsync(nameof(Startup), nameof(StartApplication), "", ex);

                throw;
            }
        }
        private async Task StartApplication()
        {
            try
            {
                // NOTE: Service not yet recieve and process requests here

                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

                Log.WriteMonitor("", $"Env: {Program.EnvInfo}", "Started");
#if (!DEBUG)
                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, Log);
#endif
            }
            catch (Exception ex)
            {
                Log.WriteFatalError(nameof(Startup), nameof(StartApplication), ex);
                throw;
            }
        }
        private async Task StartApplication()
        {
            try
            {
                // NOTE: Service not yet recieve and process requests here

                await ApplicationContainer.Resolve<IStartupManager>().StartAsync();

                HealthNotifier?.Notify("Started");

                #if (!DEBUG)

                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, Log);

                #endif
            }
            catch (Exception ex)
            {
                Log?.Critical(ex);
                throw;
            }
        }
        private async Task StartApplication()
        {
            try
            {
                Log.WriteMonitor("", Program.EnvInfo, "Initializing");

                // NOTE: Job not yet recieve and process IsAlive requests here

                await ApplicationContainer.Resolve <IStartupManager>().StartAsync();

                Log.WriteMonitor("", Program.EnvInfo, "Started");

#if DEBUG
                TelemetryConfiguration.Active.DisableTelemetry = true;
#else
                await AutoRegistrationInMonitoring.RegisterAsync(Configuration, _monitoringServiceUrl, Log);
#endif
            }
            catch (Exception ex)
            {
                Log.WriteFatalError(nameof(Startup), nameof(StartApplication), ex);
                throw;
            }
        }