Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IDbUpgradeChecker dbUpgradeChecker)
        {
            loggerFactory.AddNLog();

            if (_environment.IsDevelopment() || _environment.IsEnvironment("IntegrationTests"))
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/error");
            }

            app.UseSwagger();
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint("/swagger/v1/swagger.json", GetType().GetTypeInfo().Assembly.GetName().Name);
            });

            app.UseMvc();

            dbUpgradeChecker.EnsureDatabaseUpToDate();

            app.UseHealthChecks("/healthcheck", new HealthCheckOptions
            {
                Predicate      = _ => true,
                ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
            });

            if (_environment.EnvironmentName.Equals("IntegrationTests") == false)
            {
                app.UseHealthChecksUI();
            }
        }
Example #2
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDbUpgradeChecker dbUpgradeChecker)
        {
            app.UseHealthChecks("/healthcheck", new HealthCheckOptions
            {
                Predicate      = _ => true,
                ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
            });

            app.UseAuthentication();
            app.UseApiServices(Configuration, env);
            dbUpgradeChecker.EnsureDatabaseUpToDate(env);
        }
Example #3
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDbUpgradeChecker dbUpgradeChecker)
        {
            dbUpgradeChecker.EnsureDatabaseUpToDate(env);
            app.UseHealthChecks("/healthcheck", new HealthCheckOptions
            {
                Predicate      = _ => true,
                ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
            });

            app.UseAuthentication();
            app.UseApiServices(Configuration, env);

            app.UseStaticFiles();
            //   app.UseStaticFiles(new StaticFileOptions()
            //   {
            //       FileProvider = new PhysicalFileProvider(
            //Path.Combine(Directory.GetCurrentDirectory(), @"Resources")),
            //       RequestPath = new PathString("/Resources")
            //   });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseCookiePolicy();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=SiteConfiguration}/{action=Index}/{id?}");
            });
        }
Example #4
0
 public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IDbUpgradeChecker dbUpgradeChecker)
 {
     _startup.Configure(app, loggerFactory, dbUpgradeChecker);
 }