asp.net Core 跨域配置

1.添加中间件

在ConfigureServices中添加

 //跨域中间件服务
            services.AddCors();

 

在 Configure中添加

 

 //跨域配置
            app.UseCors(builder => builder.WithOrigins("http://example.com").AllowAnyHeader());

  

猜你喜欢

转载自www.cnblogs.com/xuqp/p/9996687.html