Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法初始化OData。使用Breeze,需要支持远程OData服务_Javascript_Wcf_Odata_Breeze - Fatal编程技术网

Javascript 无法初始化OData。使用Breeze,需要支持远程OData服务

Javascript 无法初始化OData。使用Breeze,需要支持远程OData服务,javascript,wcf,odata,breeze,Javascript,Wcf,Odata,Breeze,我正在尝试使用breeze调用wcf服务,bij配置breeze使用OData。但我还是犯了一个错误: Unable to initialize OData, Needed to support remote OData services 我也尝试过:breeze.config.initializedapterninstance(“数据服务”、“OData”) 下面是我想要使用的html页面 <!DOCTYPE html> <html xmlns="http://www.w

我正在尝试使用breeze调用wcf服务,bij配置breeze使用OData。但我还是犯了一个错误:

Unable to initialize OData, Needed to support remote OData services 
我也尝试过:
breeze.config.initializedapterninstance(“数据服务”、“OData”)

下面是我想要使用的html页面

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../Scripts/jquery-2.0.2.js"></script>
    <script src="../Scripts/knockout-2.2.1.debug.js"></script>
    <script src="../Scripts/q.js"></script>
    <script src="../Scripts/breeze.debug.js"></script>

    <script>
       breeze.core.config.setProperties({
            // the OData provider
            remoteAccessImplementation: breeze.entityModel.remoteAccess_odata,
            // this is the Knockout provider but we also provide a Backbone provider
            //  and we have others on the way
            trackingImplementation: breeze.entityModel.entityTracking_ko
        });


        var myServiceName =             "http://597de06c06404b47b1f1f592c56f6753.cloudapp.net/GoedendoelDataService.svc/?      $format=json";
        var em = new breeze.entityModel.EntityManager( {serviceName: myServiceName });

        var query = breeze.entityModel.EntityQuery.from("Goedendoel")
            .where("title", "startsWith", "G")
            .orderBy("title");

        em.executeQuery(query).then(function(data) {
            // process the results here.
            ko.applyBindings(data);
         }).fail(function (e) {
            alert(e);
        });

    </script>
 </head>
 <body>
    <p data-bind="visible: !results">Fetching data ... </p>
     <ul data-bind="foreach: results, visible: results" style="display: none">
        <li>
            <span data-bind="text:title"></span>
        </li>
     </ul>
</body>
 </html>

breeze.core.config.setProperties({
//OData提供者
remoteAccess实现:breeze.entityModel.remoteAccess\u odata,
//这是淘汰提供者,但我们也提供了主干提供者
//我们还有其他人在路上
跟踪实现:breeze.entityModel.entityTracking\u ko
});
var myServiceName=”http://597de06c06404b47b1f1f592c56f6753.cloudapp.net/GoedendoelDataService.svc/?      $format=json”;
var em=new breeze.entityModel.EntityManager({serviceName:myServiceName});
var query=breeze.entityModel.EntityQuery.from(“Goedenddoel”)
.其中(“标题”、“开头语”、“G”)
.订购人(“所有权”);
em.executeQuery.then(函数(数据){
//在这里处理结果。
ko.应用绑定(数据);
}).失败(功能(e){
警报(e);
});
正在获取数据


对于Breeze的OData支持,您还需要Microsoft提供的库。这里还有更多信息: