// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, AuthenticationContext context, UserManager <ApplicationUser> userManager, RoleManager <AppRole> roleManager) { app.Use(async(ctx, next) => { await next(); if (ctx.Response.StatusCode == 204) { ctx.Response.ContentLength = 0; } }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(builder => builder.WithOrigins(Configuration["ApplicationSettings:Client_URL"].ToString()) .AllowAnyHeader() .AllowAnyMethod() ); app.UseAuthentication(); app.UseMvc(); Seedvalue.Initialize(context, userManager, roleManager).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, AppIdentityDbContext context, RoleManager <AppRole> roleManager, UserManager <AppUser> userManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //SeedDatabase.Initialize(app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope().ServiceProvider); app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseStaticFiles(); app.UseHttpsRedirection(); app.UseMvc(routes => { routes.MapRoute( name: "areas", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}" ); }); Seedvalue.Initialize(context, userManager, roleManager).Wait(); }