te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Edge on Windows 10 32-Bit blocking ajax call to localhost with Network Error 0x2efd - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Edge on Windows 10 32-Bit blocking ajax call to localhost with Network Error 0x2efd - Stack Overflow

programmeradmin3浏览0评论

We have an app that uses SignalR to talk to scanner drivers locally that has been in production for a couple of years working on IE, Chrome and Firefox, which do not have a problem pulling down the hubs js header file for SignalR. Once Edge came out we saw an issue with talking to localhost and after long efforts of finding a setting to allow it to municate (and many hours with a Microsoft ticket that they found no solution), we settled on adding headers to allow Edge to grant access to domain:

Access-Control-Allow-Origin: https://localhost:11000

This seemed to work, but little did we notice that it worked for a 64-Bit Windows 10 Edge, but did not on 32-Bit Windows 10 Edge. I have spent hours lowering all security settings for all zones and disabling Protected Mode, trying different ajax tricks to pull the file, but continue to get the error:

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not plete the operation due to error 00002efd.

The following pseudo code fails:

$.ajax({
    url: "https://localhost:11000/signalr/hubs",
    crossDomain: true,
    success: function (data) {
        console.log("success");
    },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log("error:");
        console.log(jqXHR);
    }
});

I'm looking for any insight into settings or anything else to try, or if anyone else has seen this issue. One other piece of information, fiddler doesn't show any traffic for the call so it is being blocked by the browser it would seem. Also on the same puter that fails with Edge - IE, Chrome and FF will succeed.

We have an app that uses SignalR to talk to scanner drivers locally that has been in production for a couple of years working on IE, Chrome and Firefox, which do not have a problem pulling down the hubs js header file for SignalR. Once Edge came out we saw an issue with talking to localhost and after long efforts of finding a setting to allow it to municate (and many hours with a Microsoft ticket that they found no solution), we settled on adding headers to allow Edge to grant access to domain:

Access-Control-Allow-Origin: https://localhost:11000

This seemed to work, but little did we notice that it worked for a 64-Bit Windows 10 Edge, but did not on 32-Bit Windows 10 Edge. I have spent hours lowering all security settings for all zones and disabling Protected Mode, trying different ajax tricks to pull the file, but continue to get the error:

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not plete the operation due to error 00002efd.

The following pseudo code fails:

$.ajax({
    url: "https://localhost:11000/signalr/hubs",
    crossDomain: true,
    success: function (data) {
        console.log("success");
    },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log("error:");
        console.log(jqXHR);
    }
});

I'm looking for any insight into settings or anything else to try, or if anyone else has seen this issue. One other piece of information, fiddler doesn't show any traffic for the call so it is being blocked by the browser it would seem. Also on the same puter that fails with Edge - IE, Chrome and FF will succeed.

Share Improve this question asked Jun 16, 2016 at 20:20 Steven EdisonSteven Edison 5275 silver badges18 bronze badges 8
  • Couple of questions and things to check. First, verify localhost resolves to 127.0.0.1 (I've seen people who mess with the hosts file and really screw stuff up). Second, is the certificate a valid cert? Or a self-signed cert? – dmeglio Commented Jun 16, 2016 at 20:41
  • @dman2306 If it's working in 64 bit but not 32 bit then it can't be the hosts file due to that being a global resource. I also suggested certificates in my answer – TechnicalTophat Commented Jun 17, 2016 at 5:48
  • The certificate is right as it works with the other 3 browsers. Also the certificate is not expired. We generate a self-signed cert at the time of install that lasts a very long time. Additionally this is not a one puter issue, it has gone through our QA team and has seen the same issue on multiple 32-bit puters, but not on multiple 64-bit puters. It is tested with various configurations. The issue ONLY presents itself on 32-bit Edge. 32-bit Win 7 IE and even 32-Bit Win 10 IE works. – Steven Edison Commented Jun 17, 2016 at 14:07
  • @StevenEdison from what I've seen, Edge will reject self signed certs for cross-domain with the exact error coed you mentioned. Hence why I mentioned it. Why it's only happening in 32bit I have no idea, but I've experienced this exact issue when using self signed certs – dmeglio Commented Jun 17, 2016 at 14:24
  • There really is no other options. This is an unusual situation as we are installing the certificates on client puters to have a mini server running on their puter, no one is going to sign a "localhost" cert that is distributed to over 100,000 puters (literally). Up until this point we have had to jump through some hurdles to make things work (especially with FF), but have not seen the issue except on Edge 32-bit. Thanks for the info dman2306, we will take that into consideration as we continue to look at the issue. – Steven Edison Commented Jun 17, 2016 at 14:35
 |  Show 3 more ments

5 Answers 5

Reset to default 1

Your request is missing the following attributes, adding which should solve the problem.

  1. Request method: GET, POST, etc.
  2. Request content-type (header): application/json, etc.
  3. Request data-type (header): json, XML, etc.

Also look at the following code snippet:

type:"POST",
contentType:"application/json; charset=utf-8",
dataType:"json"

Try it in IE patibility mode by going into dev tools and selecting from the top drop down, if the error is still occurring with this on, chances are that it's some Windows system files that IE uses. Does this call use authentication with certificates? Maybe the certificate is out of date or Edge uses a different authentication method? Check your sources tab in IE (both patible and non patible) to see if the resource is being loaded, as Fiddler only captures HTTP and HTTPS traffic. That should point you in the right direction with regards to errors etc. Finally, maybe just code up a C# app that makes a request to the same URL, it's possible that the new version of .NET uses the same dependencies that could be breaking your call. If so, C# will give you enough of a descriptive error to fix the issue

I had the same issue. While Ajax calls to a page on the same domain were working in every other browser, in Edge they wouldn't. Opening the url used for the Ajax call in a different tab would give the correct results. Adding the piece of code to the page serving the Ajax calls fixed it somehow... The code is in C# but maybe this will give a general idea how to fix it in other languages.

    if (Request.UserHostName == "127.0.0.1")
        Response.AppendHeader("Access-Control-Allow-Origin", "*");

you can try this.

    $.ajax({
        url:url,
        type:"POST",
        data:data,
        contentType:"application/json; charset=utf-8",
        dataType:"json",
        success: function(){
        //
        }
    });

and make sure to properly provide the parameters, content-type, data-type, responseCode..etc

I had similar problem with Edge. The fix needed changes in ajax call and server running at localhost.

In ajax call I had to change from old text/plain to application/json

contentType: 'application/json; charset=utf-8',

Local server was using Jersey so there I added ContainerResponseFilter implementation that adds Access-Control-Allow-Headers and Access-Control-Allow-Methods headers. Access-Control-Allow-Origin was in place already.

res.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization");
res.getHeaders().add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
发布评论

评论列表(0)

  1. 暂无评论