i have a .net web api 2 method where i am trying to have some part of my code do something in a separate thread, however after I call the .Wait() method on the task it never hits the next line. I must be overlooking something, but I can't seem to find it. Here's a very simple version of the issue. The line Ok() never gets hit. Any suggestions?
public IHttpActionResult Get() {
var attachTask = AttachNewTasksAsync();
//do something else
attachTask.Wait();
return Ok();
}
public async System.Threading.Tasks.Task AttachNewTasksAsync()
{
await System.Threading.Tasks.Task.Delay(10000);
}