【发布时间】:2013-03-29 13:45:00
【问题描述】:
我使用以下发布方法开发了一个 WCF 服务:
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "/InsertBearingData")]
bool InsertBearingData(String JSONString);
我正在使用 Fiddler 为这个方法制定一个 HTTP POST 请求,但是它返回 Status Code - 400 Bad Request。这是制定的要求:
请求标头:
Host: localhost:21468
Content-Length: 96
Content-Type: application/json
请求正文:
[{"start time":"29-03-2013 11:20:11.340","direction":"SW","end time":"29-03-2013 11:20:14.770"}]
您能告诉我如何制定一个好的请求以获得成功的响应吗?
【问题讨论】:
-
您如何托管服务?请求的 URI 是什么?
-
我刚刚在 Visual Studio 中运行。 URI 是:localhost:21468/DBService.svc/InsertBearingData
-
您说
I'm using Fiddler to formulate an HTTP POST- 您在 Fiddler 上使用了哪个 URL? Visual Studio 中的项目类型是什么(即你在运行什么)? -
它是一个 WCF 服务应用程序。 Fiddler中使用的URI是:localhost:21468/DBService.svc/InsertBearingData
标签: wcf http-post httprequest fiddler