Unable to write data to remote HTTPS server

D

dina_vr

Hi All,
I am getting lot of
System.IO.IOException: Unable to write data to the transport
connection.
exceptions when I write to a Stream which is connected to a Remote
HTTPS server using a proxy and a certificate.

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(..........);

HttpWebRequest req = (HttpWebRequest) WebRequest.Create(m_url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = data.Length;
req.Proxy = new WebProxy( ...........);
req.Credentials = new NetworkCredential(..........);
req.ClientCertificates.Add(........);

Stream reqStream = req.GetRequestStream();
reqStream.Write(data, 0, data.Length); // THROWS IOException here

The exception is thrown in almost 50% of the write request throughout
the day. Here is the exception I get.

System.IO.IOException: Unable to write data to the transport
connection.
at System.Net.TlsStream.InnerWrite(Boolean async, Byte[] buffer,
Int32 offset
, Int32 size, AsyncCallback asyncCallback, Object asyncState)
at System.Net.TlsStream.BeginWrite(Byte[] buffer, Int32 offset,
Int32 size, A
syncCallback asyncCallback, Object asyncState)
at System.Net.Connection.BeginWrite(Byte[] buffer, Int32 offset,
Int32 size,
AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginWrite(Byte[] buffer, Int32 offset,
Int32 siz
e, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at NASDTrace.MyHttpResource.GetFile()

Thanks in advance.
Dhina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top