Net.WebException: The operation has timed out? RRS feed

  • Pergunta

  • Hi All,


    We have a web client code which applies load to the web server. The app is multi-threaded C# code on .Net 3.5.  We noticed that: after the app ran for a while, the server throughput (ASP.Net requests per seconds ) dropped to zero, there was no request sent to web server at all at client side. We got Net.WebException: The operation has timed out in the app log file. The app would continue running and stuck in that state.


    Debugging the app using WinDBG, we found the current connections (m_CurrentConnections in  _ServicePoint object inside HttpWebRequest object) reached the connection limit (m_CurrentConnections) which is 1000 in the app.  Looking at the following code snippet, you can see that we have called response.Close() to close connection. But don’t know why connections are still building up. Could you please tell me how to release connections? Or any solution for the problem?



    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

    request.Timeout = 10000;

    request.KeepAlive = false;

    string html = null;


    using( HttpWebResponse response = (HttpWebResponse)request.GetResponse() )


    Stream rs = response.GetResponseStream();

    StreamReader sr = new StreamReader(rs);

    html = sr.ReadToEnd();




    Any suggestion will be appreciated!



    quarta-feira, 11 de fevereiro de 2009 00:58