Error at System.Net.ConnectStream.EndReadWithoutValidation

  • Thread starter Thread starter Gary Brewer
  • Start date Start date
G

Gary Brewer

My problem is -

This only occurs intermittently, it appears it happens on larger files that
I attempt to download using the WebRequest method.

The exception is thrown at sr.ReadToEnd();

It makes no different using or not using a BufferedStream.


My problem is similar to that at
http://groups.google.com/groups?hl=...=UTF-8&q=endreadwithoutvalidation&sa=N&tab=wg



My exception is -

Message "The request was aborted: The request was canceled."

StackTrace " at
System.Net.ConnectStream.EndReadWithoutValidation(NestedSingleAsyncResult
castedAsyncResult)\r\n at System.Net.ConnectStream.EndRead(IAsyncResult
asyncResult)\r\n at System.Net.ConnectStream.Read(Byte[] buffer, Int32
offset, Int32 size)\r\n at System.IO.BufferedStream.Read(Byte[] array,
Int32 offset, Int32 count)\r\n at System.IO.StreamReader.ReadBuffer(Char[]
userBuffer, Int32 userOffset, Int32 desiredChars, Boolean&
readToUserBuffer)\r\n at System.IO.StreamReader.Read(Char[] buffer, Int32
index, Int32 count)\r\n at System.IO.StreamReader.ReadToEnd()\r\n at
HZRSSNotifier.helperMods.rssLoader.respStreamLoad(IAsyncResult res) in
c:\\documents and settings\\gary\\my documents\\visual studio
projects\\hzrssnotifier\\helpermods\\rssloader.cs:line 143" string



My code is


WebRequest wrq=(WebRequest)res.AsyncState;
WebResponse resp=wrq.EndGetResponse(res);

StreamReader sr=new StreamReader(new
BufferedStream(resp.GetResponseStream()));
string rssData=sr.ReadToEnd();
resp.Close();
sr.Close();
 
Back
Top