G
Guest
Hai,
I'm trying to run an remote asp page which is on Windows 2003 server. After
running 2 Minutes i'm getting the following error (On Browser & Inside VB.NET
too).
The underlying connection was closed: An unexpected error occurred on a
receive.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at FetchHTMLContent(String RemoteURL, String& DownloadContent, Int32
TimeoutSeconds) in D:\Proj\VB.NET\clsUploadDownload.vb:line 20
VB.NET Code to run an asp page and return it's asp response.write's valu
--------------------------------------------------------------------------------------
Private Function FetchHTMLContent(ByVal RemoteURL As String, ByRef
DownloadContent As String, Optional ByVal TimeoutSeconds As Integer = 300) As
Boolean
Try
Dim objRequest As System.Net.HttpWebRequest
Dim objResponse As System.Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objStreamRead As System.IO.StreamReader
objRequest = CType(System.Net.WebRequest.Create(New
Uri(RemoteURL.ToString.Trim)), System.Net.HttpWebRequest)
'objRequest.KeepAlive = False
'objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy()
'objRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
'objRequest.ProtocolVersion = System.Net.HttpVersion.Version10
'objRequest.Method = "GET"
'objRequest.ContentType = "application/x-www-form-urlencoded"
'objRequest.AllowAutoRedirect = True
'objRequest.MaximumAutomaticRedirections = 10
objRequest.Timeout = TimeoutSeconds * 1000 'Default 5 minutes
'objRequest.UserAgent = "Mozilla/3.0 (compatible; My Browser/1.0)"
objResponse = CType(objRequest.GetResponse(), System.Net.WebResponse)
objStreamReceive = objResponse.GetResponseStream
objStreamRead = New System.IO.StreamReader(objStreamReceive,
System.Text.Encoding.UTF8)
DownloadContent = objStreamRead.ReadToEnd()
FetchHTMLContent = True
Catch ex As Exception
Microsoft.VisualBasic.MsgBox(ex.Message.ToString &
Microsoft.VisualBasic.vbCrLf & ex.StackTrace)
End Try
End Function
So after googling found some tips to come accross this, but none of them
works for me
-----------------------------------------------------------------------------------------------------
1. KeepAlive set to false.
2. Set proxy objects & passed credentials
2. In IIS changed "Connection timeout" to 1800 seconds.
3. Changed responseDeadlockInterval as 00:30:00
httpRuntime executionTimeout = 1800
in file
%windir%\Microsoft.Net\Framework\<Framework_Version>\Config\Machine.config.
Any Ideas?
Bye
Ajai
I'm trying to run an remote asp page which is on Windows 2003 server. After
running 2 Minutes i'm getting the following error (On Browser & Inside VB.NET
too).
The underlying connection was closed: An unexpected error occurred on a
receive.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at FetchHTMLContent(String RemoteURL, String& DownloadContent, Int32
TimeoutSeconds) in D:\Proj\VB.NET\clsUploadDownload.vb:line 20
VB.NET Code to run an asp page and return it's asp response.write's valu
--------------------------------------------------------------------------------------
Private Function FetchHTMLContent(ByVal RemoteURL As String, ByRef
DownloadContent As String, Optional ByVal TimeoutSeconds As Integer = 300) As
Boolean
Try
Dim objRequest As System.Net.HttpWebRequest
Dim objResponse As System.Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objStreamRead As System.IO.StreamReader
objRequest = CType(System.Net.WebRequest.Create(New
Uri(RemoteURL.ToString.Trim)), System.Net.HttpWebRequest)
'objRequest.KeepAlive = False
'objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy()
'objRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
'objRequest.ProtocolVersion = System.Net.HttpVersion.Version10
'objRequest.Method = "GET"
'objRequest.ContentType = "application/x-www-form-urlencoded"
'objRequest.AllowAutoRedirect = True
'objRequest.MaximumAutomaticRedirections = 10
objRequest.Timeout = TimeoutSeconds * 1000 'Default 5 minutes
'objRequest.UserAgent = "Mozilla/3.0 (compatible; My Browser/1.0)"
objResponse = CType(objRequest.GetResponse(), System.Net.WebResponse)
objStreamReceive = objResponse.GetResponseStream
objStreamRead = New System.IO.StreamReader(objStreamReceive,
System.Text.Encoding.UTF8)
DownloadContent = objStreamRead.ReadToEnd()
FetchHTMLContent = True
Catch ex As Exception
Microsoft.VisualBasic.MsgBox(ex.Message.ToString &
Microsoft.VisualBasic.vbCrLf & ex.StackTrace)
End Try
End Function
So after googling found some tips to come accross this, but none of them
works for me
-----------------------------------------------------------------------------------------------------
1. KeepAlive set to false.
2. Set proxy objects & passed credentials
2. In IIS changed "Connection timeout" to 1800 seconds.
3. Changed responseDeadlockInterval as 00:30:00
httpRuntime executionTimeout = 1800
in file
%windir%\Microsoft.Net\Framework\<Framework_Version>\Config\Machine.config.
Any Ideas?
Bye
Ajai