HttpClient GetAsync always says "WaitingForActivation"

I am new to HttpClient. My code below always says "WaitingForActivation" in status. Please, help

private static async Task<HttpResponseMessage> MakeCall() { var httpclient = new HttpClient(); var response = await httpclient.GetAsync("http://localhost:60565/Subscribers"); return response; } 
+4
source share
2 answers

Alternatively, if your environment is synchronous, add .Result , for example:

 GetAsync("http://localhost:60565/Subscribers").Result; 
+3
source

This is normal. Just await returned task (asynchronously) until it finishes.

You can find a useful intro to async .

+1
source

Source: https://habr.com/ru/post/1500880/


All Articles