// 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.UseExceptionHandlerMiddleware(); } 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(); } var scopeFactory = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>(); var scope = scopeFactory.CreateScope(); SecuritySeedData.Initialize(scope.ServiceProvider); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapAreaControllerRoute( name: "Identity", areaName: "Identity", pattern: "Identity/{controller=Account}/{action=Login}/{id?}"); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
public void Configure(IApplicationBuilder app) { if (Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } var scopeFactory = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>(); var scope = scopeFactory.CreateScope(); SecuritySeedData.Initialize(scope.ServiceProvider); app.UseStaticFiles(); app.UseRouting(); app.UseIdentityServer(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); }); }