Async ≠ non-blocking.
The trap
public async Task<IActionResult> Get()
{
var data = _service.GetDataAsync().Result;
return Ok(data);
}
Why it blocks
-
.Resultblocks the request thread -
Can cause thread starvation under load
Fix
var data = await _service.GetDataAsync();
