问题描述
我有一个非常简单的 ajax 请求(见下文).服务器正在使用 CORS,并且在 IE 10+、Chrome、Firefox 和 Opera 中运行良好.但是,在 Microsoft Edge 上,它会失败并显示
I have a very simple ajax request (see below). The server is using CORS and works fine in IE 10+, Chrome, Firefox and Opera. On Microsoft Edge however, it fails with
XMLHttpRequest:网络错误 0x80070005,访问被拒绝.
XMLHttpRequest: Network Error 0x80070005, Access is denied.
我研究了这里,这里,这里和这里,但找不到答案作品.那些人在使用 IE 时遇到了问题,但是添加 contentType(此获取不需要)和 crossDomain 可以正常工作.
I have researched the posts here, here, here and here, but cannot find an answer that works. Those people have had issues with IE, but adding the contentType (not required for this get) and crossDomain has it working fine.
CanIUse 似乎表明 CORS 在 Edge 中可用.该请求在 IE9 关闭时也会失败,但 CanIUse 仅声明对 CORS 的部分支持,所以这是可以理解的.
CanIUse seems to state that CORS is usable in Edge. The request also fails on IE9 down, but CanIUse states only partial support for CORS, so that's understandable.
请问有什么办法可以解决这个问题吗?
Any ideas how I can fix this please?
代码:
$.ajax({
crossDomain: true,
url: "http://localhost:2023/api/DoAction/test",
success: function (a) {
var res = JSON.parse(a);
alert(res.content);
},
error: function (a, e, r) {
alert(a.responseText);
}
});
更新
添加更多信息以防提供任何线索 - ajax 请求来自 Azure 并发布到使用 OWIN 自托管创建的 localhost 网站.这是不寻常的,但软件(只能在本地使用)从云服务获取数据是必需的.如前所述,它适用于所有其他浏览器,Edge 是唯一的问题.
To add further information in case it provides any clues - the ajax request is coming from Azure and posting to a localhost website created using OWIN self hosting. This is unusual, but required for the software (which can only be used locally) to get data from a cloud service. As stated, it works fine for all other browsers, Edge is the only problem.
推荐答案
对于使用 Microsoft Edge 的开发人员来说,这个问题应该不再存在.如果您在 localhost 测试中遇到问题,请导航到 about:flags,并确保选中 Allow localhost loopback.
This problem should no longer exist for developers using Microsoft Edge. If you experience issues with localhost testing, navigate to about:flags, and make sure Allow localhost loopback is checked.
Microsoft Edge当前不支持(开箱即用)本地主机测试.但是,您可以按照此处提供的指南启用它:http://dev.modern.ie/platform/faq/how-can-i-debug-localhost/.
Microsoft Edge does not currently support (out of the box) localhost testing. You can however enable it by following the guidance provided here: http://dev.modern.ie/platform/faq/how-can-i-debug-localhost/.
我们正在努力在未来的版本中解决此问题.
We're working on resolving this in a future release.
这篇关于XMLHttpRequest:网络错误 0x80070005,在 Microsoft Edge(但不是 IE)上拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)