472,094 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,094 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 3224
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Chris Botha | last post: by
4 posts views Thread by Chris Botha | last post: by
reply views Thread by leo001 | last post: by

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.