本文介绍了WinJS.xhr:网络错误 0x2efd,由于错误 00002efd 无法完成操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用 JavaScript 开发 Windows 8 Metro 应用程序时遇到 WinJS.xhr 问题.

I have problem with WinJS.xhr when developing a Windows 8 Metro application in JavaScript.

WinJS.xhr({ url: "http://www.seznam.cz"});

当上面的代码被执行时,我在日志中看到:

When above code is executed, I see in log:

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

我在清单中启用了互联网(客户端)"功能.

I have enabled "Internet (Client)" capability in manifest.

也许问题是因为我使用代理并使用 VPN,但我可以使用 Google Chrome 访问互联网(我只需要授权,否则 HTTP 状态 407 - 需要代理授权).

Maybe the problem is because I am behind proxy and using VPN, but I can access internet using Google Chrome (I just need to authorize, otherwise HTTP Status 407 - proxy authorization needed).

我该如何解决?

所以我发现这可能和我必须使用的VPN(Cisco VPN Client)有关.当我禁用 VPN 时,即使我在代理后面(我使用 LAN,使用 VPN 我使用 WiFi),请求也会起作用.也许它只与 Cisco VPN 相关.我不得不修改注册表,因为它在这里描述 http://verbalprocessor.com/2012/09/17/windows-8-and-cisco-vpn-client/

So I found that it is probably related to the VPN I have to use (Cisco VPN Client). When I disable the VPN, even when I am behind the proxy (I use the LAN, with VPN I use WiFi), the request works. Maybe it is only Cisco VPN related. I had to modify registry as it is described here http://verbalprocessor.com/2012/09/17/windows-8-and-cisco-vpn-client/

另外有趣的是,当我使用代理时,一些 Metro 应用程序可以工作(地图),而有些则无法工作(Windows 商店).

Also interesting is that a few Metro apps work (maps) and some do not work (windows store) when I am behind proxy.

请注意:我已经探索了 Windows.Networking.Connectivity,在这两种情况下(有/没有 VPN)我都得到 NetworkConnectivityLevel == "Local Access"(因为我可能在代理后面).

Just a notice: I have explored Windows.Networking.Connectivity and in both cases (with/without VPN) I get NetworkConnectivityLevel == "Local Access" (because I am behind the proxy probably).

推荐答案

我在连接到我的工作场所 SSL/VPN 连接(来自瞻博网络)时遇到了同样的错误.

I got the same error when connected to my workplace SSL/VPN connection (from Juniper).

打开 .appxmanifest 文件并添加私有网络(家庭和服务器)"功能解决了该问题.

Opening the .appxmanifest file and adding the "Private Networks (Home & Server)" capability solved the issue.

<Capabilities>
  <Capability Name="internetClient" />
  <Capability Name="privateNetworkClientServer" />
</Capabilities>

这篇关于WinJS.xhr:网络错误 0x2efd,由于错误 00002efd 无法完成操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 22:32
查看更多