After six months flawless operation, I'm suddenly getting this error:
"Unable to read data from the transport connection." The code* hasn't
changed, and from what I can see, neither have the IP address, network
card, security protocols, etc. The code works fine on other machines,
but the critical one -- the one it's supposed to work on -- fails. The
stack trace** doesn't seem to help me out, but I thought perhaps someone
here could shed some light on where the problem might be occurring.
Thanks for any pointers!
--Brent
-------------------------------------------------------------
*Code:
=================================
HttpWebResponse oResponse = null;
HttpWebRequest oRequest = null;
Stream data = null;
StreamReader reader = null;
try
{
// Get HTML data
int tmp = ServicePointManager.DefaultConnectionLimit;
oRequest = (HttpWebRequest)WebRequest.Create(strURL);
oRequest.KeepAlive = false;
oRequest.Timeout = 10000; // 10 seconds
oRequest.UserAgent = "Web Client";
oResponse = (HttpWebResponse)oRequest.GetResponse();
if (oResponse.StatusCode == HttpStatusCode.OK)
{
data = oResponse.GetResponseStream();
reader = new StreamReader(data);
//Read from start the finish, line by line.
while ((thisRow = reader.ReadLine()) != null)
{
//do a bunch of stuff
}
}//end HttpWebResponse status code test
else
{
strError = "Bad HttpWebRequest status.";
}
reader.Close();
data.Close();
oResponse.Close();
}
catch(WebException e)
{
emit(e.Message + " Status: " + e.Status);
}
catch (Exception ex)
{
emit(ex.Message + "\n" + ex.StackTrace);
//ERROR IS CAUGHT HERE!
}
finally
{
if (reader != null){reader.Close();}
if(data != null){data.Close();}
if(oResponse != null){oResponse.Close();}
}
GC.Collect();
===============================
**Error & Stack Trace
===============================
Unable to read data from the transport connection
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32
offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.Connection.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.InternalBeginRead(Int32 bytesToRead,
NestedSingleAsyncResult castedAsyncResult, Boolean fromCallback)
at System.Net.ConnectStream.BeginReadWithoutValidatio n(Byte[]
buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at nsImport13F.ImportThirteenF.writeHoldingstoDB(Stri ng strURL)" at
16:50:49
===============================