AggregateException is throwing while waiting for PostAsJsonAsync

后端 未结 1 822
陌清茗
陌清茗 2021-02-08 09:04

AggregateException is throwing while waiting for API post to complete how i could fix this?

My API call is similar like this

using (var httpClient          


        
1条回答
  •  野性不改
    2021-02-08 09:41

    Are you posting a big piece of data ? Once I had a similar issue. I believe the underlying problem is occasional timeout due to bandwidth issues. I tried getting the task and manually waiting on it then checking .IsFaulted and .IsCancelled but the .Result throws AggregateException / TaskCancelledException.

    Maybe you should try to increase HttpClient.Timeout property which is 100 sec by default ?

    0 讨论(0)
提交回复
热议问题