473,403 Members | 2,359 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,403 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 3382
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.