WCF方法发送POST不是GET的 [英] WCF method sending POST instead of GET

查看:160
本文介绍了WCF方法发送POST不是GET的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建访问REST API WCF客户端。该API需要一个GET用于某个呼叫,所以我使用的方法[WebGet]属性。然而,当我调用该方法,所产生的实际调用是POST(通过使用招查看)。我的合同是如下:

I'm trying to create a WCF client that accesses a REST API. The API requires that a GET be used for a certain call, so I'm using the [WebGet] attribute for the method. However when I call the method, the actual call that is produced is a POST (viewed by using Fiddler). My contract is as below:

[OperationContract]
[WebGet(UriTemplate = "/statuses/public_timeline.json",
BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
List<Status> PublicTimeline();

我用[WebInvoke]用GET方法,但没有成功,也试过。

I've also tried using [WebInvoke] with a method of GET but with no success.

推荐答案

我使用的是WCF服务做一些工作,然后调用另一个WCF服务。这是有上面提到的问题,第二个服务。原来,这个问题是第一个服务是如何实现的。

I was using a WCF service to do some work and then call another WCF service. It was the second service that had the issue mentioned above. The problem turned out to be how the first service was implemented.

解决方案是在这里:<一href=\"http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/03a2b109-c400-49d4-891e-03871ae0d083/#416d8cbc-b855-46aa-8a6d-5d6b09db97b6\">http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/03a2b109-c400-49d4-891e-03871ae0d083/#416d8cbc-b855-46aa-8a6d-5d6b09db97b6

这篇关于WCF方法发送POST不是GET的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆