public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger <Startup> logger, AppDbContext appDbContext, IdentityDbContext identityDbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Ganjeh.Api v1")); appDbContext.CreateAndMigrateAppDB(); identityDbContext.CreateAndMigrateAuthDB(userManager, roleManager); app.ConfigureExceptionHandler(logger); // app.UseHttpsRedirection(); app.UseRouting(); app.UseCors("ApiCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }