【发布时间】:2013-09-30 15:14:05
【问题描述】:
我使用 StackyClient 库来遍历 Stack Overflow 中的最新问题。通常这是有效的:
StackyClient client = new StackyClient("1.1", "", Sites.MetaStackOverflow, new UrlClient(), new JsonProtocol());
var o = new QuestionOptions();
...
IPagedList<Question> l = null;
while (!stop) {
l = client.GetQuestions(o);
var newQuestions = (from Question q in l
orderby q.Id descending
select q).ToList();
...
}
但在某些时候,这似乎失败了。可能是由于网络连接问题或者我不知道是什么。程序挂在client.GetQuestions(o)。
我想检测该问题并重新连接。 我想过以某种方式设置超时以防止程序挂起。怎么做?
【问题讨论】:
标签: c# timeout httpwebrequest stacky