Fix CORS problem

In our application StartUp.cs, we have a problem that we need to fix and this one is the CORS problem. We will start by adding CORS to our application. In our ConfigureServices we need to add:

// Add cors
services.AddCors();

And next in our Configure method we need to add the following line:

app.UseCors(x => x.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());

Last updated