1
for (int i = 0; i < endurance / 10; i++) {
    log.Info("mining now : " + endurance / 10 + " - " + i);
    HttpWebRequest mineRequest = WebRequestUtil.CreateHttpWebRequest(Properties.Settings.Default.PAGE_URL + Properties.Settings.Default.MINING_URL);

    string source = SourceParser.GetSource(mineRequest); // GETTING TIMED OUT HERE
    string variable = GetHiddenVariableNumber(source);

    Mine(variable);
}

我的 GetSource 方法:

public static string GetSource(WebRequest request) {
    using (WebResponse response = request.GetResponse()) {
        using (Stream stream = response.GetResponseStream()) {
            using (StreamReader reader = new StreamReader(stream)) {
                return reader.ReadToEnd();
            }
        }
    }
}

日志:

2013-03-03 02:10:56,101 [13] INFO  Bot.Game.Mining mining now : 10 - 0
2013-03-03 02:10:57,053 [13] INFO  Bot.Game.Mining mining now : 10 - 1
2013-03-03 02:10:58,155 [13] INFO  Bot.Game.Mining mining now : 10 - 2 // ends here

有什么建议么?我读了很多关于它的内容,通常的问题不是处置StreamWebResponse反对,但我正在这样做。

4

0 回答 0