【发布时间】:2017-06-06 10:22:56
【问题描述】:
我试着发帖休息。
这是我的代码:
string URL = "http://xxx.xxx.x.xx:8080/Name/NAME/";
string urlParameters = "?key=T_PAPPS&value=sofsof";
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(URL);
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
HttpResponseMessage response = client.PostAsync(URL, new StringContent(urlParameters)).Result;
我的应用是 WinForm 应用(不是网页)。
我做错了什么?
感谢您的提前。
(restsharp 返回相同的错误(我也没有成功从 application/json 更改为 application/x-www-form-urlencoded))
【问题讨论】:
-
它可能不接受 POST 请求。
标签: c# rest httpclient restsharp