对RESTful WCF服务的POST请求出现问题 [英] Problem with POST request to RESTful WCF Service
本文介绍了对RESTful WCF服务的POST请求出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试向我的静态WCF服务发出发布请求.合同如下所示:
I am trying to make a post request to my restful WCF service. The contract looks like this:
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat=WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "UploadMovie")]
string UploadMovie(Stream stream);
或
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat=WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "UploadMovie")]
string UploadMovie(byte [] stream);
我正在尝试使用提琴手发出请求,但我无法获得它可以通过在请求中添加一些内容来起作用.身体需要什么样?我一直在体内编写正确的Json,但仍然不好...
I am trying to use Fiddler to make a request, yet I am not able to get it to work by putting some body in the request. What does the body need to look like? I have been writing the correct Json in the body but still no good...
谢谢
推荐答案
我的问题是我没有在帖子标题中设置内容类型
My problem was that i w as not setting the content-type in the post header
这篇关于对RESTful WCF服务的POST请求出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文