So, I have this Web API action, that executes an asynchronous function.
public void Post([FromBody]InsertRequest request)
{
InsertPostCommand.Execute(request);
DoAsync();
}
private async void DoAsync()
{
await Task.Run(() =>
{
//do async stuff here
});
}
I actually want the controller action to return to the client whilst the async operation executes.
I did this and I am getting an exception thus:
System.InvalidOperationException: An asynchronous module or handler completed while an asynchronous operation was still pending.
How can I achieve this please ??
Thanks