Problem with POST request to RESTful WCF Service

不打扰是莪最后的温柔 提交于 2020-01-25 00:45:07

问题


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);

or

    [OperationContract]
    [WebInvoke(Method = "POST",
                 RequestFormat = WebMessageFormat.Json,
                 ResponseFormat=WebMessageFormat.Json,
               BodyStyle = WebMessageBodyStyle.Wrapped,
               UriTemplate = "UploadMovie")]
    string UploadMovie(byte [] stream);

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...

Thanks


回答1:


My problem was that i w as not setting the content-type in the post header



来源:https://stackoverflow.com/questions/1144166/problem-with-post-request-to-restful-wcf-service

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!