Невозможно прочитать данные из транспортного соединения :Соединение было закрыто, ошибка в консольном приложении

У меня есть этот код в консольном приложении, и он работает в цикле

 try
 {
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search);
      request.Headers.Add("Accept-Language", "de-DE");
      request.Method = "GET";
      request.Accept = "text/html";
      using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
      {
           using (StreamReader reader = new StreamReader(response.GetResponseStream(),
                    Encoding.ASCII))
           {
                string html = reader.ReadToEnd();
                    FindForMatch(html, url);
           }
      }
 }
 catch (Exception ex)
 {
      throw new Exception(ex.Message);
 }

после нескольких циклов это дает

Unable to read data from the transport connection: The connection was closed

ошибка. Любая идея, почему это происходит? спасибо..

11
задан Darshana 4 July 2012 в 06:33
поделиться