
[OperationContract] [WebInvoke(UriTemplate = "/findcategorIEs",Method = "GET",RequestFormat = Webmessageformat.Json,ResponseFormat = Webmessageformat.Json)] FindCategorIEsResponse FindCategorIEs(FindCategorIEsRequest request);
但是当我尝试这个时,我得到了例外:
Operation 'FindCategorIEs' in contract 'IComplaintService' uses GET,but also has body parameter 'request'. GET operations cannot have a body. Either make the parameter 'request' a UriTemplate parameter,or switch from WebGetAttribute to WebInvokeAttribute.
谢谢
解决方法Is there no way of accepting a JsON object as a parameter when doing GET request?
不.使用GET请求,您可以使用查询字符串参数.如果要发送整个JsON对象,则应使用POST.
总结以上是内存溢出为你收集整理的c# – 使用JSON请求对象的WCF REST GET?全部内容,希望文章能够帮你解决c# – 使用JSON请求对象的WCF REST GET?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)