WinJS.xhr 本地网络错误 [英] WinJS.xhr local network error
本文介绍了WinJS.xhr 本地网络错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作一个简单的 Windows 8 应用程序,但我遇到了问题.当我尝试向本地网络服务器发出 xhr 请求时,它失败并显示错误代码:0x2efd
I am trying to make a simple windows 8 app but I have a problem. When I try to make a xhr request to a local webserver it fails with the error code: 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)时,它可以工作.出了什么问题?
But when I try a remote IP for instance google.com it works. What is going wrong?
推荐答案
您是否在项目的应用程序清单中声明了专用网络"功能?双击您的应用程序清单文件 - 它位于功能选项卡下.
Did you declare the "private network" capability in your project's application manifest? Double click your application manifest file - It is located under the capabilities tab.
这篇关于WinJS.xhr 本地网络错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文