Calling external HTTP service using HttpClient from a Web API Action
Aha, I needed to do the following (return a Task rather then void): // GET api/values public async Task<IEnumerable<string>> Get() { var result = await GetExternalResponse(); return new string[] { result, “value2” }; } private async Task<string> GetExternalResponse() { var client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(_address); response.EnsureSuccessStatusCode(); var result = await response.Content.ReadAsStringAsync(); … Read more