string url = "http://www.xxx.com/api/postmsg";
string jsonContent = JsonConvert.SerializeObject(message);
using (var client = new HttpClient())
{
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
//上面代码使http Content-Type 为 application/json; charset=utf-8。如果希望Content-Type为application/json,可以使用下面两行代码
//content.Headers.Remove("Content-Type"); // "{application/json; charset=utf-8}"
//content.Headers.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer");
string result = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
}