no ‘access-control-allow-origin’ header is present on the requested resource request request

Try to move app.UseCors(“CorsPolicy”) outside if (env.IsDevelopment());

and change your services.AddCors to anotner syntax:

services.AddCors(opt =>  opt.AddPolicy("CorsPolicy", c =>
            { 
                c.AllowAnyOrigin()
                   .AllowAnyHeader()
                    .AllowCredentials()
                    .AllowAnyMethod();
            }));

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top