在这种情况下,将IO绑定代码放在IO线程上吗?还是我需要使Get方法async
和await PassThroughTask
?
//Some controller class
[HttpGet]
public Task<ActionResult> Get()
{
PassThroughTask();
return Ok("passthrough");
}
public async Task PassThroughTask()
{
//Is this going to stop the IoBoundWork from going to the IO thread?
await SomeIoBoundWorkAsync();
}
public async Task SomeIoBoundWorkAsync(){ //await async io stuff}