元数据查询失败:Breeze JS

时间:2013-03-30 06:28:23

标签: javascript knockout.js asp.net-web-api breeze

我正在使用ASP.net Web Api开发Breeze JS To Dos应用程序。当我向资源请求时,我得到“元数据查询失败:odata / Todos / Metadata; NaN”。但是,当我手动请求/ odata / Todos / Metadata时,它工作正常。你对此有什么想法吗?

2 个答案:

答案 0 :(得分:6)

尝试:

var dataService = new breeze.DataService({
    serviceName: "http://localhost:2099/api/yourcontent/",
    hasServerMetadata: false,
});

var manager = new breeze.EntityManager({ dataService: dataService });

答案 1 :(得分:2)

我发现datajs中的MaxDataServiceVersion标头导致404s ...

尝试

var oldClient = OData.defaultHttpClient;
var myClient = {
    request: function (request, success, error) {
        delete request.headers.MaxDataServiceVersion;
        return oldClient.request(request, success, error);
    }
};
OData.defaultHttpClient = myClient;