Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

HttpWebRequest Err: An unexpected error occurred on a receive

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ajai - 13 Jul 2005 07:49 GMT
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
sinc - 14 Jul 2005 20:28 GMT
Same issue.  Can't figure out yet... began for me at 6:30pm PDT 7/11/05

> Hai,
>
[quoted text clipped - 61 lines]
> Bye
> Ajai
redhotsly@hotmail.com - 22 Jul 2005 18:59 GMT
Very interesting. We also started getting this error on 7/11/05. Did
you figure out the cause?

Thanks

Sylvain
Rick Sypriano - 07 Aug 2005 17:21 GMT
I also had the same problem and I was able to solve it by increasing the
"Connection Timeout" in IIS.

Rick
sinc - 14 Jul 2005 22:42 GMT
Interestingly: when I use a proxy for this connection everything works
great.  Of course, can't do this in production environment.  Seems that
effects are cascading now--perhaps related to new MS auto updates?

> Hai,
>
[quoted text clipped - 61 lines]
> Bye
> Ajai
Joerg Jooss - 16 Jul 2005 13:21 GMT
>  Hai,
>
[quoted text clipped - 58 lines]
> %windir%\Microsoft.Net\Framework\<Framework_Version>\Config\Machine.co
> nfig.

Try fixing your resource leak: You neither close your reader, nor your
stream, nor your response. Close at the least the reader within a
finally block.

Cheers,
Signature

http://www.joergjooss.de
mailto:news-reply@joergjooss.de


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.