您应该设置内容类型。使用“接受”可以定义要作为响应的内容。
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 接受请求标头字段可用于指定响应可接受的某些媒体类型。接受标头可用于指示该请求特别限于一小部分所需类型,例如在请求嵌入式图像的情况下。
public async TaskSendPost(Model model) { var client = new HttpClient(); //You should extract this and reuse the same instance multiple times. var request = new HttpRequestMessage(HttpMethod.Post, Url + "api/foo"); using(var content = new StringContent(Serialize(model), Encoding.UTF8, "application/json")) { request.Content = content; var response = await client.SendAsync(request).ConfigureAwait(false); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync().ConfigureAwait(false); } }