windows 8 wcf web service (localhost/intranet)

windows 8 wcf web service (localhost/intranet)

本文关键字:localhost intranet service wcf web windows      更新时间:2024-06-09

我正在尝试从metro应用程序调用web服务。我正在用javascript开发这个应用程序,Web服务是基于wcf的。

我这样试过:

function callWCF() {
WinJS.xhr({
    type: "GET",
    url: "http://lei-023880-ws.sinternal.de:8732/sdata/myApp/myContract/-/employees",
}).done(
function (result) {
    console.log(result.responseText)       
},
function (request) {
}
);}

或者像这样:

 var xhr = new XMLHttpRequest();
        xhr.open("GET", "http://lei-023880-ws.s.de:8732/sdata/myApp/myContract/-/$schema", true);
        xhr.responseType = "text";
        xhr.onreadystatechange = function () {
            if (xhr.readyState == xhr.DONE) {
                var blob = xhr.reponse;
                window.console.log(blob);
            }
        }
        xhr.send(); 

我得到的只是一个网络错误,代码为:2efd。我在谷歌上搜索了一下。这是一个"Internet_cannot_connect"错误。当我将网址更改为"microsoft.com"时,它工作正常。所以我想问题出在wcf服务上?当在windows 8浏览器中调用URL时,它也可以工作。为什么应用程序无法调用url?

提前谢谢。

robidd

由于microsoft.com正常工作,听起来好像在清单中设置了互联网连接选项?(不是想成为显而易见的队长:),但我有几次忽视了这一点!)

你可以试试Fiddler,看看请求进展到什么程度——如果有的话。使用Windows 8的Fiddler很棘手,但这篇文章应该可以帮助你设置:http://blogs.msdn.com/b/fiddler/archive/2011/09/14/fiddler-and-windows-8-metro-style-applications-https-and-private-network-capabilities.aspx