gpt4 book ai didi

c# - HttpWebRequest .Net Core 设置超时

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:18 30 4
gpt4 key购买 nike

我正在尝试在 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 .

enter image description 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.

关于c# - HttpWebRequest .Net Core 设置超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42674327/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com