open startup.cs page .net core project
In ConfigureServices() method:
public void ConfigureServices(IServiceCollection services)
{
--------
services.AddCors();
--------
}
In Configure() method:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
--------
app.UseCors(builder =>
builder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
);
--------
}