//客户端请求
HttpClient http = new HttpClient();
var str = "";//请求数据。这里为空
HttpContent content = new StringContent(str);
//请求地址
string url = "http://localhost:5833/api/Test/GetPostInfo";
Task<HttpResponseMessage> postTask = http.PostAsync(url,content);
HttpResponseMessage result = postTask.Result;//拿到网络请求结果
result.EnsureSuccessStatusCode();//抛出异常
Task<string> task = result.Content.ReadAsStringAsync();//异步读取数据
//发送值前台
ViewBag.ResultTyle = JsonConvert.DeserializeObject<ResultType>(task.Result);