Model view controller 被CORS策略阻止:对飞行前请求的响应
错误:对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“访问控制允许来源”标头Model view controller 被CORS策略阻止:对飞行前请求的响应,model-view-controller,core,Model View Controller,Core,错误:对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“访问控制允许来源”标头 MVC Core 3.1 API cor config services.AddCors(options => options.AddPolicy(CorsPolicy, builder => { builder .AllowAn
MVC Core 3.1 API cor config
services.AddCors(options => options.AddPolicy(CorsPolicy,
builder =>
{ builder
.AllowAnyMethod()
.AllowAnyHeader()
.WithOrigins("https://www.hotff.com",
"https://www.hotff.com:44389","https://localhost:4200",
"http://localhost:4200","https://localhost:44371",
"http://localhost:4300","http://127.0.0.1:8080") //.AllowAnyOrigin()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowCredentials();
}));
此配置可从Angular 8客户端运行,端口无问题
当API部署在IIS 10服务器上时,请求可以从边缘浏览器正常工作,但不能从android或crome浏览器工作。尝试了所有我能找到的解决方案,阅读了所有我能找到的
我想问题是飞行前的请求…我不得不求助于客户端代理方法来修复这个不理想但有效{“/myAPI/*”:{“target”:“secure”:false,“logLevel”:“debug”}如果可能的话,我希望服务器端修复。我不得不求助于客户端代理方法来修复这个不理想但有效{“/myAPI/*”:{“target”:““secure”:false,“logLevel”:“debug”}}如果可能的话,我想要一个服务器端修复程序。