// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(config => config.SwaggerEndpoint("/swagger/v1/swagger.json", "v1") ); app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); ServiceCollectionExtension.UpdateDatabase(app); }
public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationContext>(w => w.UseSqlServer(Configuration.GetConnectionString("Default")).EnableSensitiveDataLogging()); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1) .AddJsonOptions( options => { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.ContractResolver = new DefaultContractResolver(); } ); ServiceCollectionExtension.AddLogging(services); services.AddSettings(Configuration); services.AddServices(); services.AddBackgroundWorkers(); services.AddJsonDeserializers(); }