【问题标题】:unable to read data from the transport connection the connection was closed无法从传输连接读取数据连接已关闭
【发布时间】:2015-01-15 16:38:02
【问题描述】:

我正在使用HTML Agility Pack 库读取页面的 HTML,但遇到此错误:

无法从传输连接读取数据,连接已关闭。

这是我的代码:

var getHtmlWeb = new HtmlWeb();

for (int j = 0; j < arr.Length; j++)
{
    var document = getHtmlWeb.Load(arr[j].ToString());  // error line
}

如何延长超时时间?

【问题讨论】:

标签: c# html-agility-pack


【解决方案1】:

我建议您先将 html/texts 加载到本地计算机,然后再将其加载到您的敏捷包中。如果你真的需要调整它,你可以使用 HttpWebRequest 它有超时属性。

看这个>> How can I download HTML source in C#

【讨论】:

  • 实际上我已经使用敏捷库完成了所有代码。
  • 那么,我只是为您的超时请求提供另一种选择。
  • 我得到了解决方案兄弟,thanx :) refactoringaspnet.blogspot.in/2010/04/…
猜你喜欢
  • 1970-01-01
  • 2017-07-19
  • 1970-01-01
  • 1970-01-01
  • 2011-04-23
  • 2023-01-11
  • 1970-01-01
  • 2020-11-03
  • 1970-01-01
相关资源
最近更新 更多