【问题标题】:Breeze API Controller - The 'ObjectContent`1' type failed to serialize the response body for content typeBreeze API 控制器 - 'ObjectContent`1' 类型未能序列化内容类型的响应正文
【发布时间】:2013-03-28 03:19:48
【问题描述】:

我在尝试调用时遇到此错误

public object Lookups() {

  var divisions = _contextProvider.Context.Divisions;                      

  return divisions;
}

在 Breeze API 控制器上。

ObjectContent`1' 类型未能序列化内容类型的响应正文

我做错了什么?

【问题讨论】:

    标签: asp.net-web-api breeze single-page-application hottowel


    【解决方案1】:

    返回一个对象,而不是一个 IQueryable。

    public object Lookups() {
    
      var divisions = _contextProvider.Context.Divisions;                      
    
      return new { divisions };
    }
    

    【讨论】:

    • 问题仍然存在......我也尝试从 Division POCO 类中删除所有虚拟集合 - 也没有......
    猜你喜欢
    • 2012-10-07
    • 2017-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-27
    • 2012-12-12
    • 1970-01-01
    • 2013-10-01
    相关资源
    最近更新 更多