locked
Why the HttpRequest Timeout? RRS feed

  • 問題

  •   Hello everyone , i just had a problem about HttpRequest Timeout , my codes below.

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(reportUri);

    httpRequest.ContentType = "application/x-www-form-urlencoded";

    httpRequest.Method = "GET";

    httpRequest.Timeout = 1000*30;

    httpRequest.UserAgent = this.userAgent;

    //Stream str=httpRequest.GetRequestStream();

    httpResponse = (HttpWebResponse)httpRequest.GetResponse();

    xmlReport.ReportSender.StatusCode = (int)httpResponse.StatusCode;

    xmlReport.ReportSender.Error = string.Empty;

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    this is just a part of the code in "for" circle , i really send two request to server successful , but the third time , i get the time out Error , but i don't know why , could anyone here help me?

    thanks very much..


    Jing Guo's Facebook profile
    2009年2月2日 6:41

解答

  • Ok.. I know why..

    because in for circle .. i did not close the httpRequest , so the httpRequest is timeout , this is not the time out of the server .. just in code..
    Jing Guo's Facebook profile
    2009年2月2日 7:00

所有回覆

  • Ok.. I know why..

    because in for circle .. i did not close the httpRequest , so the httpRequest is timeout , this is not the time out of the server .. just in code..
    Jing Guo's Facebook profile
    2009年2月2日 7:00
  • Be sure that we must close the httpRequest after using it.
    Microsoft MVP, Microsoft Community Star(TW & HK), MCT, MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA
    2009年2月4日 8:41