CORS header not being set for internal server error response ASP.NET Core 3.1
问题 Here is my CORS configuration: services.AddCors(options => { options.AddPolicy(name: "AllowedOrigins", policyBuilder => { var urls = Configuration.GetSection("Host:AllowedOrigins").Get<List<string>>(); policyBuilder.WithOrigins(urls.ToArray()) .AllowAnyMethod() .AllowAnyHeader() .SetIsOriginAllowed((host) => true) .AllowCredentials(); }); }); And in Configure method: app.UseRouting(); app.UseCors("AllowedOrigins"); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints =>