I'm using this async code for my project:
public async Task<IEnumerable<Area>> GetAreas()
{
var webclient = new WebClient();
var result = await webclient.DownloadStringTaskAsync(new Uri(uri)).ConfigureAwait(false);
return JsonConvert.DeserializeObject<IEnumerable<Area>>(result);
}
public async Task<ActionResult> Index()
{
var areas = GetAreas();
Task.WaitAll(areas);
return View(model: areas);
}
I have tried this but when i debug my program areas variable have this properties: status:waiting for activation, method:"", Result : "". I know this happen because deadlock async.
please help me to solve my problem.