If the domain name of the current request site is wwww.aaa.com and the domain address of the target interface is www.bbb.com, cross-domain is disabled by core framework default and an error will be displayed during the request

1. Cross-domain error message

2. Background solutions

In the startup. cs file, add the code as follows

public IServiceProvider ConfigureServices(IServiceCollection services)
{
   services.AddCors();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  app.UseCors(builder => builder
                .AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader()
                .AllowCredentials());
}
Copy the code

3, access through the effect