corspost请求失败_CORS POST请求不工作 - OPTIONS(错误请求) - 起源是不允许的

在尝试跨域POST请求时遇到问题,浏览器返回OPTIONS请求为400 Bad Request,POST请求为404 Not Found。已尝试多种解决方案,包括web.config配置修改和IIS设置调整,但问题依然存在。Fiddler抓包显示Access-Control-Allow-Origin头已包含正确域名,但浏览器仍报不允许的起源错误。最后发现,Fiddler中OPTIONS响应头出现重复的"Access-Control-Allow-XXX"字段,移除web.config中多余的EnableCors配置后,问题解决。
摘要由CSDN通过智能技术生成

I'm having a lot of trouble getting a cross domain POST request to hit an Api controller in the latest beta 2 release.

Chrome (and other browsers) spit out:

OPTIONS http://api.hybridwebapp.com/api/values 400 (Bad Request)

POST http://api.hybridwebapp.com/api/values 404 (Not Found)

It may be related to this issue but I have applied that workaround and several other fixes such as web.config additions here

I've been banging my head with this for a while so I created a solution to reproduce the problem exactly.

Load the web app there will be 2 buttons one for GET one for POST and the response will appear next to the button. GET works. Cannot get POST to return successfully.

I'm able to get a hint at the cause from Fiddler but it makes no sense because if you look at the response it DOES incl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值