473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Cannot access a disposed object named "System.Net.TlsStream"

Hi Friends,

We recently deployed our application to production and I am experiencing the
below error message.

Cannot access a disposed object named "System.Net.TlsStream"

The error occurs when we are making a web service call to an external system
(within our corporate n/w). The method is POST and the URL is over HTTPS.

The error is very intermittent and and the impact is not serious. However,
this issue has reached maximum visibility and I am under extreme pressure to
have it resolved as soon as possible.

I checked the KB article : http://support.microsoft.com/kb/884537/ and found
that it could be a know issue with .net 1.1. and that we have a patch to fix
the same.

I read another article http://support.microsoft.com/kb/824721/en-us on the
window server 2003 sp 1 list of updates and find a reference to the above
issue as one of the fixes.

I then checked all our servers and found that they run on windows 2003
server with SP 1. I also double confirmed by checking the version of mscorlib
dll and found it is 1.1.4322.2300. This would mean that the above error
should be handled by windows 2003 sp1. But the error still occurs. The error
is only in our production environment and has never occured in our test and
staging environment.

Below is the code where we make the webservice call.

HttpWebRequest HttpWRequest =
(HttpWebRequest)WebRequest.Create(oCurrentWESServi ceDesc.WESServiceURL);
HttpWRequest.Timeout =
Convert.ToInt32(Convert.ToInt32(oCurrentWESService Desc.MaxTimeout)*1000);
HttpWRequest.Method = "POST";
byte[] PostData = System.Text.Encoding.UTF8.GetBytes
(WrappedEIAInputXML.InnerXml);
HttpWRequest.ContentLength = PostData.Length;
Stream tempStream = HttpWRequest.GetRequestStream();

tempStream.Write(PostData,0,PostData.Length);
tempStream.Close();

if(null != HttpWResponse)
{
HttpWResponse.Close(); // close any previous connection
HttpWResponse = null; // clear the object.
}

HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();

I really need some help in resolving this issue ASAP. Thank you very in
advance!

Regards,
red

Jan 25 '07 #1
2 3372
Hi Red,

Were you able to solve the problem?

I am looking at the code and I am trying to understand where it fails: is it
because tempStream becames a NULL object or maybe because
tempStream.Write(PostData,0,PostData.Length) is trying to write no data?

Have you tried tracing the code, writting the output to a file when the
error occurs, just to see under what condition the error happens? I
understand the application is in production but maybe you can add a flag in
the web.config and turn it on for a limited period of time just to cactch the
error. (I have read recently an article on MSDN with a firm who developed a
tool to trace the requests in a web application and figure out a Microsoft
bug which was happening once at 100.000 requests.)

I have found this while reading in the MSDN library about
HttpWebRequest.GetRequestStream method, maybe you already know it:
" In a .NET Compact Framework application, a request stream with zero
content length was not obtained and closed correctly. For more information
about handling zero content length requests:
http://msdn2.microsoft.com/en-us/library/1afx2b0f.aspx

Anyway, it will be nice to know how did you handled this issue.

Best regards,
Eugen

"red" wrote:
Hi Friends,

We recently deployed our application to production and I am experiencing the
below error message.

Cannot access a disposed object named "System.Net.TlsStream"

The error occurs when we are making a web service call to an external system
(within our corporate n/w). The method is POST and the URL is over HTTPS.

The error is very intermittent and and the impact is not serious. However,
this issue has reached maximum visibility and I am under extreme pressure to
have it resolved as soon as possible.

I checked the KB article : http://support.microsoft.com/kb/884537/ and found
that it could be a know issue with .net 1.1. and that we have a patch to fix
the same.

I read another article http://support.microsoft.com/kb/824721/en-us on the
window server 2003 sp 1 list of updates and find a reference to the above
issue as one of the fixes.

I then checked all our servers and found that they run on windows 2003
server with SP 1. I also double confirmed by checking the version of mscorlib
dll and found it is 1.1.4322.2300. This would mean that the above error
should be handled by windows 2003 sp1. But the error still occurs. The error
is only in our production environment and has never occured in our test and
staging environment.

Below is the code where we make the webservice call.

HttpWebRequest HttpWRequest =
(HttpWebRequest)WebRequest.Create(oCurrentWESServi ceDesc.WESServiceURL);
HttpWRequest.Timeout =
Convert.ToInt32(Convert.ToInt32(oCurrentWESService Desc.MaxTimeout)*1000);
HttpWRequest.Method = "POST";
byte[] PostData = System.Text.Encoding.UTF8.GetBytes
(WrappedEIAInputXML.InnerXml);
HttpWRequest.ContentLength = PostData.Length;
Stream tempStream = HttpWRequest.GetRequestStream();

tempStream.Write(PostData,0,PostData.Length);
tempStream.Close();

if(null != HttpWResponse)
{
HttpWResponse.Close(); // close any previous connection
HttpWResponse = null; // clear the object.
}

HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();

I really need some help in resolving this issue ASAP. Thank you very in
advance!

Regards,
red
Jan 31 '07 #2
Hi Eugen,

Since its a production environment I am not in a position to change even a
web.config entry for a short period of time.

I will try to generate the trace with the help of someone from the Infra
team and get back to you.

Thanks again

red

"Eugen" wrote:
Hi Red,

Were you able to solve the problem?

I am looking at the code and I am trying to understand where it fails: is it
because tempStream becames a NULL object or maybe because
tempStream.Write(PostData,0,PostData.Length) is trying to write no data?

Have you tried tracing the code, writting the output to a file when the
error occurs, just to see under what condition the error happens? I
understand the application is in production but maybe you can add a flag in
the web.config and turn it on for a limited period of time just to cactch the
error. (I have read recently an article on MSDN with a firm who developed a
tool to trace the requests in a web application and figure out a Microsoft
bug which was happening once at 100.000 requests.)

I have found this while reading in the MSDN library about
HttpWebRequest.GetRequestStream method, maybe you already know it:
" In a .NET Compact Framework application, a request stream with zero
content length was not obtained and closed correctly. For more information
about handling zero content length requests:
http://msdn2.microsoft.com/en-us/library/1afx2b0f.aspx

Anyway, it will be nice to know how did you handled this issue.

Best regards,
Eugen

"red" wrote:
Hi Friends,

We recently deployed our application to production and I am experiencing the
below error message.

Cannot access a disposed object named "System.Net.TlsStream"

The error occurs when we are making a web service call to an external system
(within our corporate n/w). The method is POST and the URL is over HTTPS.

The error is very intermittent and and the impact is not serious. However,
this issue has reached maximum visibility and I am under extreme pressure to
have it resolved as soon as possible.

I checked the KB article : http://support.microsoft.com/kb/884537/ and found
that it could be a know issue with .net 1.1. and that we have a patch to fix
the same.

I read another article http://support.microsoft.com/kb/824721/en-us on the
window server 2003 sp 1 list of updates and find a reference to the above
issue as one of the fixes.

I then checked all our servers and found that they run on windows 2003
server with SP 1. I also double confirmed by checking the version of mscorlib
dll and found it is 1.1.4322.2300. This would mean that the above error
should be handled by windows 2003 sp1. But the error still occurs. The error
is only in our production environment and has never occured in our test and
staging environment.

Below is the code where we make the webservice call.

HttpWebRequest HttpWRequest =
(HttpWebRequest)WebRequest.Create(oCurrentWESServi ceDesc.WESServiceURL);
HttpWRequest.Timeout =
Convert.ToInt32(Convert.ToInt32(oCurrentWESService Desc.MaxTimeout)*1000);
HttpWRequest.Method = "POST";
byte[] PostData = System.Text.Encoding.UTF8.GetBytes
(WrappedEIAInputXML.InnerXml);
HttpWRequest.ContentLength = PostData.Length;
Stream tempStream = HttpWRequest.GetRequestStream();

tempStream.Write(PostData,0,PostData.Length);
tempStream.Close();

if(null != HttpWResponse)
{
HttpWResponse.Close(); // close any previous connection
HttpWResponse = null; // clear the object.
}

HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();

I really need some help in resolving this issue ASAP. Thank you very in
advance!

Regards,
red
Jan 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: aspmenu.net | last post by:
Hi, We have built a c# dot net web page that has an online regristraion. It uses a XML HTTPS POST to a payment gateway to do a credit card payment. It crashes every now and again with -...
0
by: Asaf | last post by:
Hi, When I am doing a POST to a SSL URL I am getting this error on first attempt "Cannot access a disposed object named "System.Net.TlsStream"." After the first attempt all works fine, here is the...
5
by: SMike | last post by:
I am getting the following error when sending a first http request: Cannot access a disposed object named "System.Net.TlsStream". After that everything sems to be fine untill the next long idle...
2
by: Asaf | last post by:
Hi All, When doing HTTP POST to SSL URL I am getting the error: Cannot access a disposed object named "System.Net.TlsStream". I have found this code in the internet but it does not solve the...
0
by: Ronald S. Cook | last post by:
I'm just curious how you would handle this. In the cable industry, Comcast is referred to as an "MSO" (multiple systems operator) meaning they own many cable systems. Therefore a solution must be...
5
by: Chris Botha | last post by:
There is a database table with one of the columns named "System". When creating a new Dataset for this table, the project gives a huge number of compile errors. If I change the column name to be...
4
by: Chris Botha | last post by:
The customer has a database with a column in a table named "System". I've been using this method for years now - create a dataset (an .xsd file) for the table. With a column named "System" in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.