Setting HttpClient to a too short timeout crashes process

前端 未结 2 1879
南方客
南方客 2021-01-31 03:40

I\'ve noticed that when I\'m using System.Net.HttpClient with a short timeout, it may sometimes crash the process, even when it is wrapped in a try-catch block. Her

2条回答
  •  Happy的楠姐
    2021-01-31 03:59

    HttpWebRequest.Abort() is throwing an exception on a background/timer thread. This has nothing to do with HttpClient's Task management.

    The exception from HttpWebRequest.Abort() should be fixed in .NET 4.5 GDR1. http://support.microsoft.com/kb/2750149 http://support.microsoft.com/kb/2750147

提交回复
热议问题