代码之家  ›  专栏  ›  技术社区  ›  Daniel

对RESTful WCF服务的POST请求存在问题

  •  1
  • Daniel  · 技术社区  · 17 年前

    我正在尝试向我的restful WCF服务发出post请求。合同如下所示:

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

    我正在尝试使用 Fiddler 提出一个请求,但我无法通过在请求中加入一些人来实现它。身体需要什么样子?我一直在写正确的Json在身体,但仍然没有好。。。

    谢谢

    1 回复  |  直到 17 年前
        1
  •  1
  •   Daniel    17 年前

    我的问题是我没有在帖子标题中设置内容类型