【问题标题】:unable to return nested type to client from wcf json enabled service无法从启用 wcf json 的服务向客户端返回嵌套类型
【发布时间】:2013-01-07 16:24:48
【问题描述】:

我无法从 wcf json 服务返回嵌套类型。当我从 RestClient (firefox) 执行 http get 时,服务操作会执行两次,并且响应正文为空。 从 chrome 中的 url 调用相同的服务返回 未收到数据。错误 324 ERR_EMPTY_RESPONSE

这是代码

[WebInvoke(Method=”GET”, ResponseFormat=WebMessageFormat.Json, RequestFormat= WebMessageFormat.Json, UriTemplate=”GetProducts/storedId”] 公共服务响应>> GetAllProducts(string storeId) { // 从数据库中获取产品列表的代码。 }

[数据合约] 公开课产品 { [数据成员] 公共字符串名称 {get;设置;}

[数据成员] 公共 IList ProductDetails {get;放;} }

有人可以提出问题所在吗?谢谢

【问题讨论】:

    标签: json wcf


    【解决方案1】:

    我让 WCF 使用 Json.NET (http://json.codeplex.com/) 在 .NET 对象和 JSON 之间进行转换

    【讨论】:

      猜你喜欢
      • 2015-01-31
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多