Last post Nov 08, 2017 10:17 PM by mgebhard
Nov 06, 2017 10:21 PM|sapator|LINK
httpWebRequest.Timeout = 30
"https://www.google.com:81" . this will always give me a 60 seconds timeout, although I am modifying the httpWebRequest.Timeout value.
' Create a request for the URL.
Dim request As HttpWebRequest = _
' 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.
' 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.
' Clean up the streams and the response.
Catch ex As Exception
Although the response is for 5 seconds, i still get a wait time for a minute and "The operation has timed out".
What drives the request to go for a minute?
Nov 07, 2017 07:28 AM|Eric Du|LINK
According to your description, as far as I know, you could set it in this method or set it in webconfig, please keep the setting same in two places. About how to set it in the web.config, please check the following code:
Also please try set the keepalive to false. For more details, please check this link:
Nov 08, 2017 09:57 PM|sapator|LINK
I have tried both keepalive and executiontimeout 9in application config file) but it just won't work.
It will still go for a minute or so
Nov 08, 2017 10:17 PM|mgebhard|LINK
Probably because the there's no service listening @ https://www.google.com:81/. A connection is never made so you're probably seeing the effect of a
DNS TCP connection timeout.
Try testing with a URL under your control and set Thread.Sleep(6*1000).