public HttpResponseMessage Post(Employee employee){int maxId = list.Max(e => e.Id);employee.Id = maxId + 1;list.Add(employee);var response = Request.CreateResponse (HttpStatusCode.Created, employee);string uri = Url.Link("DefaultApi", new { id = employee.Id });response.Headers.Location = new Uri(uri);return response;}客户端 HttpClient client = new HttpClient(); // Send a request asynchronously continue when complete client.GetAsync(_address).ContinueWith( (requestTask) => { // Get HTTP response from completed task. HttpResponseMessage response = requestTask.Result; // Check that response was successful or throw exception response.EnsureSuccessStatusCode(); var products = response.Content.ReadAsAsync >().Result; foreach(var pro in products) { string text = pro.FoodName; } }