Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 04, 2010 08:24 PM by whatsavailable
May 11, 2007 01:39 AM|LINK
Sometimes, a server error "System.Net.WebException: The operation has timed out" is diplayed in my application. This happened when I try to render a report using a PDF format. But I never encounter this error when rendering in EXCEL or HTML format.
In my opinion this occurs when the report to be rendered to huge.
Is there any solution to prevent this error?
May 15, 2007 02:19 AM|LINK
First make sure you close your HTTP connections:
HttpWebRequest r = WebRequest.Create("URL");
HttpWebResponse w = r.GetResponse()
w.Close(); // Close connection here.
And you can try increasing maxRequestLength int the Httpruntime section in web.config.
For details see: http://support.microsoft.com/kb/821268
May 04, 2010 08:24 PM|LINK
I'm seeing the same issue...'System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetResponse() ' error very often on our website. We try to log the website visits and log to a differnet box.
I had googled the error and tried several fixes that were suggested, still no luck.
Here is my code.
Dim objStream As System.IO.Stream
Dim objReader As System.IO.StreamReader
Dim objRequest As System.Net.HttpWebRequest
Dim objResponse As System.Net.WebResponse
objRequest = CType(System.Net.WebRequest.Create(sbURL.ToString), System.Net.HttpWebRequest)
objRequest.Timeout = TimeOutInMilliseconds
'Fixes tried 1..no luck
objRequest.KeepAlive = False
If Not UserAgent.Equals(String.Empty) Then
objRequest.UserAgent = UserAgent
'Fixes tried 2..no luck
'Get the service point that handles the request's socket connection.
Dim point As ServicePoint = objRequest.ServicePoint
' Set the receive buffer size on the underlying socket.
point.ReceiveBufferSize = 2048
' Set the connection lease timeout to infinite.
point.ConnectionLeaseTimeout = Timeout.Infinite
point.ConnectionLimit = 1000
objResponse = objRequest.GetResponse
objStream = objResponse.GetResponseStream
objReader = New System.IO.StreamReader(objStream)
strPageContents = objReader.ReadToEnd
CURRENT_CONTEXT.Trace.Write("Response Contents", strPageContents)
'Fixes tried 3..no luck
'make sure the stream and response objects are closed to make sure we free the connection
Catch ex As Exception
'adding some more info while logging
Throw New Exception("Unable to log to webtrends" & " URL: " & sbURL.ToString, ex)
If Not objResponse Is Nothing Then
objResponse = Nothing
If Not objStream Is Nothing Then
objStream = Nothing
drLogInfo = Nothing
objReader = Nothing
I have also tried to increase mas connections....no luck there too
<add address="*" maxconnection="25" />
I have tried the following setting too....no luck.
System.Net.ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit
or System.Net.ServicePointManager.DefaultConnectionLimit = 1000
Please let me know what I'm missing.