我正在尝试在 HttpWebRequest 上设置超时,但在 .Net Core 中似乎不可能。 “超时”属性不再存在。
谢谢
请您参考如下方法:
I am trying to set the Timeout on an HttpWebRequest and it seems that it is not possible in .Net Core.
如果您使用的是 .NET Core 2.0,则在 .NET Core 中是可能的。可以看到the support for the Timeout property here .
如果可以,请使用 System.Net.Http.HttpClient相反,because...
In general, for better app performance and features, we recommend developers move away from HttpWebRequest and adopt HttpClient API surface.
