简体   繁体   中英

XMLHttpRequest: Network Error 0x80070005, Access is denied on Microsoft Edge (but not IE)

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: Network Error 0x80070005, Access is denied.

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 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?

Code:

$.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);
      }
    });

Update

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.

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 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.

对于Build 10158,命令稍有变化,将Spartan重新命名为Microsoft Edge,因此要在Microsoft Edge中启用它,请从管理员命令提示符运行以下命令:

CheckNetIsolation.exe LoopbackExempt -a -n=Microsoft.MicrosoftEdge_8wekyb3d8bbwe

就在你的ajax调用之前使用它:$ .support.cors = true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM