【问题标题】:Intermittant Repeated Timeouts from WebRequest.GetResponse connecting to Jenkins/Hudson来自连接到 Jenkins/Hudson 的 WebRequest.GetResponse 的间歇性重复超时
【发布时间】:2011-09-02 02:35:52
【问题描述】:

我正在从一个 c# 应用程序开始参数化 Jenkins 构建。

网址是有效的(我可以从日志中提取并运行它而没有问题)。在某些时候,所有 webrequests 都会超时,无论超时设置多少(我已经达到 90 秒)或运行多少次。

这是间歇性的,在某些时候,我完全不会有任何问题。

while (count<5)           
 { try{
                    log.WriteEntry("RunningJenkinsBuild- buildURL=" + buildUrl, EventLogEntryType.Information);
                    WebRequest request = WebRequest.Create(buildUrl);
                    request.GetResponse();
                    return;
                }
                catch (WebException ex)
                {
                    log.WriteEntry("Timeout- wait 15 seconds and try again-"+ex.Message, EventLogEntryType.Error);
                    Thread.Sleep(15000);
                    count++;
                }
                catch (Exception ex2)
                {
                    log.WriteEntry(ex2.Message, EventLogEntryType.Error);
                    return;
                }
            }

【问题讨论】:

    标签: c# timeout hudson webrequest jenkins


    【解决方案1】:

    这清除了它。 “使用”帮助了它。

    WebRequest 请求 = WebRequest.Create(buildUrl); 请求.超时 = 10000; 使用 (WebResponse response = request.GetResponse()) { } 线程.Sleep(5000);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-20
      • 1970-01-01
      • 1970-01-01
      • 2015-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多