.net core 跨域
public void ConfigureServices(IServiceCollection services)
#region 配置跨域 //配置跨域处理 services.AddCors(options => options.AddPolicy("CorsPolicy", builder => { builder.AllowAnyMethod() .SetIsOriginAllowed(_ => true) .AllowAnyHeader() .AllowCredentials(); })); #endregion
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
#region 配置跨域 app.UseCors("CorsPolicy"); #endregion