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

53.7k views Asked by At

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.

3

There are 3 answers

15
Sampson On BEST ANSWER

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.

1
Cedric Michel On

Just before your ajax call use this : $.support.cors = true;

0
David Wengier On

For Build 10158 the command has changed slightly, with the rebranding of Spartan fully into Microsoft Edge, so to enable it in Microsoft Edge run the following command from an administrator command prompt:

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