ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   The underlying connection was closed - Error Message (https://www.excelbanter.com/excel-discussion-misc-queries/152868-underlying-connection-closed-error-message.html)

sandeep

The underlying connection was closed - Error Message
 
Hi,

We have written a code in C# that send the data to the server in the XML
Format and gets the response in return from the server and displays the same
in the Excel.

The complete server side code is in Java.

I am getting an error message "The underlying connection was closed", when
the client is waiting for the response from the Server.... This seems to be
the time out issue....

Can any help me out as how to recover from this issue?

Thanks,
Sandeep

sandeep

The underlying connection was closed - Error Message
 
Like,

I send the data from the c# code in the xml format, which is processed at
the server side using Java and return the bulk of data back to the C# code.

This is the code is C#, written to send the data to the server and get the
response back from the server

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(mUrlPrefix);
request.CookieContainer = new CookieContainer();
request.Method = "POST";
request.ContentType = "text/xml";
request.ContentLength = xmlContent.Length;
request.Timeout = 1000000;
setCookies(request, cookiesStr);
try
{
writeToRequestStream(request, xmlContent);
}
catch (Exception e)
{
MessageBox.Show(e.Message.ToString());
}

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();

In some cases i get the reponse well from the server, but in other i am
getting an erorr message "The underlying connection was closed "

This error message is ususally thrown when the amount requested by the C#
code is huge .......

Thanks,
Sandeep

"Sandeep" wrote:

Hi,

We have written a code in C# that send the data to the server in the XML
Format and gets the response in return from the server and displays the same
in the Excel.

The complete server side code is in Java.

I am getting an error message "The underlying connection was closed", when
the client is waiting for the response from the Server.... This seems to be
the time out issue....

Can any help me out as how to recover from this issue?

Thanks,
Sandeep



All times are GMT +1. The time now is 12:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com