异步/等待Asp.Net Core何时需要异步?

时间:2019-09-13 19:51:52

标签: c# asp.net async-await

在这种情况下,将IO绑定代码放在IO线程上吗?还是我需要使Get方法asyncawait 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}

0 个答案:

没有答案
相关问题