【问题标题】:WinJS.xhr local network errorWinJS.xhr 本地网络错误
【发布时间】:2014-05-14 03:48:59
【问题描述】:

我正在尝试制作一个简单的 Windows 8 应用程序,但我遇到了问题。 当我尝试向本地网络服务器发出 xhr 请求时,它失败并显示错误代码:0x2efd

示例代码:

WinJS.xhr({ url: "http://192.168.0.30" }).then(
    function completed(response) {
        //var json = JSON.parse(response.responseText);
        //var list = new WinJS.Binding.List(json.results);

        console.log(response.responseText);
    },
    function error(error) { console.log(error) },
    function progress(progress) { }
);

但是当我尝试使用远程 IP 例如 google.com 时,它可以工作。 出了什么问题?

【问题讨论】:

    标签: windows-8 xmlhttprequest winjs


    【解决方案1】:

    您是否在项目的应用程序清单中声明了“专用网络”功能?双击您的应用程序清单文件 - 它位于功能选项卡下。

    【讨论】:

    • 另外,我必须使用 IP 才能工作,localhost 没有删减它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    • 2016-09-29
    • 2020-10-16
    • 2020-05-13
    • 2020-06-05
    • 2021-12-28
    相关资源
    最近更新 更多