httpWebRequest.Timeout On value provided or on IIS?-VBForums
Results 1 to 5 of 5

Thread: httpWebRequest.Timeout On value provided or on IIS?

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,044

    httpWebRequest.Timeout On value provided or on IIS?

    Hello.

    doing this:
    httpWebRequest.Timeout = 30
    requestStream ...etc

    I need to know if the timeout is happening on the requested url by IIS or by the webrequest.

    This is because I am trying to simulate a timeout on a web service but since i do not have access to that particular web service, I am trying by using a non existent post on google "https://www.google.com:81" . this will always give me a 60 seconds timeout, although I am modifying the httpWebRequest.Timeout value.
    So my quest is that is is the IIS timeout that i erroring out and not the url site waiting.

    Can someone confirm?
    Also if this is the case, is there a Microsoft documentation for this somewhere? I need to log it in officially.

    Thanks.
    Slow as hell.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    96,856

    Re: httpWebRequest.Timeout On value provided or on IIS?

    It's a property of the WebRequest, not IIS. It's the amount of time that the WebRequest will wait to make a connection (GetRequestStream) or receive a response (GetResponse) before giving up. Why would it have anything to do with IIS, given that the server you're making a request to could be Apache or any other web server?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,044

    Re: httpWebRequest.Timeout On value provided or on IIS?

    OK.

    What I am trying is to use a program that is part of a bigger application that, unfortunately, do not have access to.
    This program is initiated, from the app but I am not sure if the application is starting an initial web request on the "fake" url site or is giving access to my program.
    If the application is initiating, it may have trouble creating a handshake with IIS and errors out on the default IIS timeout.
    Else my program get's access.

    So to sum this up.
    If i get access to my program and start an httpWebRequest , If i cannot connect to the web site (https://www.google.com:81) I will get the expected timeout and not the IIS timeout?

    I'm trying to find the IIS setting to reduce the timeout but it may be in a web.config somewhere (as the main application, probably have a couple of thousand folders) or my be in an app dll .

    So another question is. How would IIS timeout interfere with an application, I write. How can I get the IIS timout and not the WebRequest timeout?


    Thanks.
    Slow as hell.

  4. #4

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,044

    Re: httpWebRequest.Timeout On value provided or on IIS?

    Hi.

    I have simulated a similar exception like so:
    Code:
      Try
                ' Create a request for the URL.   
                Dim request As HttpWebRequest = _
                  WebRequest.Create("https://www.google.com:81")
                ' If required by the server, set the credentials.  
                request.Credentials = CredentialCache.DefaultCredentials
                ' Get the response.  
                request.Timeout = 1000 * 5
                Dim response As WebResponse = request.GetResponse()
                ' Display the status.  
                Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
                ' Get the stream containing content returned by the server.  
    
                Dim dataStream As Stream = response.GetResponseStream()
                ' Open the stream using a StreamReader for easy access.  
                Dim reader As New StreamReader(dataStream)
                ' Read the content.  
                Dim responseFromServer As String = reader.ReadToEnd()
                ' Display the content.  
                Console.WriteLine(responseFromServer)
                ' Clean up the streams and the response.  
                reader.Close()
                response.Close()
            Catch ex As Exception
              
            End Try
    Although the response is for 5 seconds, i still get a wait time for a minute and "The operation has timed out".

    This is the behavior I am talking about and i though it is from IIS.
    If it is not IIS then what drives the request to go for a minute?

    Thanks.
    Slow as hell.

  5. #5

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,044

    Re: httpWebRequest.Timeout On value provided or on IIS?

    I have also tried HttpWebRequest.KeepAlive = false
    and used an application config to set httpRuntime executionTimeout to 5 secs as the program.

    I have actually taken another route, so now this is just curiosity. Why does the program persist? What makes it go for a minute?
    Slow as hell.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.