// // 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(); }
时间: 2024-10-24 10:29:17