// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } // app.UseHttpsRedirection (); if ((!env.IsEnvironment("Backend"))) { app.UseSpaStaticFiles(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); }); app.UseResponseCaching(); app.UseRouting(); app.UseCors(MyAllowSpecificOrigins); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); if ((!env.IsEnvironment("Backend"))) { endpoints.MapToVueCliProxy( "{*path}", new SpaOptions { SourcePath = "ClientApp" }, npmScript: (env.IsEnvironment("Backend") ? null : "serve"), regex: "Compiled successfully", forceKill: true ); } }); ServiceExtensions.CreateDefaultRolesAndUser(serviceProvider).Wait(); }