我无法从wcf json服务返回嵌套类型 . 当我从RestClient(firefox)获取http时,服务操作执行两次,响应体为空 . 从chrome中的url调用相同的服务返回没有收到数据 . 错误324 ERR_EMPTY_RESPONSE
这是代码
[WebInvoke(Method =“GET”,ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json,UriTemplate =“GetProducts / storedId”] public ServiceResponse >> GetAllProducts(string storeId){//从db获取产品列表的代码 . }
[DataContract] public class Product {[DataMember] public string Name {get;组;}
[DataMember] public IList ProductDetails {get;设置;}}
有人可以建议出了什么问题 . 谢谢
1 回答
我让WCF使用Json.NET(http://json.codeplex.com/)在.NET对象和JSON之间进行转换