首页 > 代码库 > HttpResponseMessage 调用.net web api
HttpResponseMessage 调用.net web api
// // GET: /Home/ //释迦苦僧 public ActionResult Index() { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:12899/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("api/task").Result; if (response.IsSuccessStatusCode) { var tasks = response.Content.ReadAsStringAsync(); List<TaskInfoModel> p = JsonConvert.DeserializeObject<List<TaskInfoModel>>(tasks.Result); Console.Write(tasks.Result); } return View(); }
HttpResponseMessage 调用.net web api
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。