Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > The underlying connection was closed

Reply
Thread Tools

The underlying connection was closed

 
 
kirk
Guest
Posts: n/a
 
      04-17-2007
Environment:
c#, Framwork 2.0, Win2003 server, IIS 6.0, Copy deployment (uncompiled
source code deployed to server)

I have written a web service that calls another web service. The ws I am
calling is third party, but written in .net (unknown framework version). I
am calling the 3rd party ws over https.
When my ws is called without ssl everything works great. However, when my
client is calling my ws using https, I get the following error:

The underlying connection was closed: An unexpected error occurred on a
receive.
System.Net.WebResponse GetWebResponse(System.Net.WebRequest)
....

I won't post the entire stack trace for size reasons.
The error will only pop up after a number of days of everything working just
fine. No changes on the server or the source code.

I have seen a number of 'solutions' to this problem, but they all apply to
1.0 and 1.1 frameworks. Does anyone know why this is happening and what I
can do about it in 2.0?

Thanks

Kirk


 
Reply With Quote
 
 
 
 
John Saunders [MVP]
Guest
Posts: n/a
 
      04-17-2007
"kirk" <(E-Mail Removed)> wrote in message
news:uip$(E-Mail Removed)...
> Environment:
> c#, Framwork 2.0, Win2003 server, IIS 6.0, Copy deployment (uncompiled
> source code deployed to server)
>
> I have written a web service that calls another web service. The ws I am
> calling is third party, but written in .net (unknown framework version).
> I am calling the 3rd party ws over https.
> When my ws is called without ssl everything works great. However, when my
> client is calling my ws using https, I get the following error:
>
> The underlying connection was closed: An unexpected error occurred on a
> receive.
> System.Net.WebResponse GetWebResponse(System.Net.WebRequest)
> ...
>
> I won't post the entire stack trace for size reasons.
> The error will only pop up after a number of days of everything working
> just fine. No changes on the server or the source code.
>
> I have seen a number of 'solutions' to this problem, but they all apply to
> 1.0 and 1.1 frameworks.


What did those solutions say was the cause of the problem?

> Does anyone know why this is happening and what I can do about it in 2.0?


I don't know for sure what's happening, but does your web server have SSL
configured?
--

John Saunders [MVP]


 
Reply With Quote
 
 
 
 
kirk
Guest
Posts: n/a
 
      04-17-2007
John,

1) The solutions I was finding on the web were all based on the 1.1 and 1.0
framework. They involved tweaking the resource.cs file by overriding the
WebRequest method and setting the KeepAlive = false. Basicly, force the
creation of a new connection for every request. I guess that MS had a
support item on it at
'http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b819450' but
they have since removed the topic.
I can't follow the recommend because in VS 2005, there is no resource.cs
file any more. this file is generated on the fly by the .net framework
after deployment.

2) the web service is configured for ssl using a purchased certificate.
When my client hits my ws using https, my call to the 3rd party ws fails
with the error stated. If I allow my client to hit my ws without ssl, my
call to the 3rd party ws works just fine. In both cases I am hitting the
3rd party ws using ssl.

Kirk

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
news:(E-Mail Removed)...
> "kirk" <(E-Mail Removed)> wrote in message
> news:uip$(E-Mail Removed)...
>> Environment:
>> c#, Framwork 2.0, Win2003 server, IIS 6.0, Copy deployment (uncompiled
>> source code deployed to server)
>>
>> I have written a web service that calls another web service. The ws I am
>> calling is third party, but written in .net (unknown framework version).
>> I am calling the 3rd party ws over https.
>> When my ws is called without ssl everything works great. However, when
>> my client is calling my ws using https, I get the following error:
>>
>> The underlying connection was closed: An unexpected error occurred on a
>> receive.
>> System.Net.WebResponse GetWebResponse(System.Net.WebRequest)
>> ...
>>
>> I won't post the entire stack trace for size reasons.
>> The error will only pop up after a number of days of everything working
>> just fine. No changes on the server or the source code.
>>
>> I have seen a number of 'solutions' to this problem, but they all apply
>> to 1.0 and 1.1 frameworks.

>
> What did those solutions say was the cause of the problem?
>
>> Does anyone know why this is happening and what I can do about it in 2.0?

>
> I don't know for sure what's happening, but does your web server have SSL
> configured?
> --
>
> John Saunders [MVP]
>
>



 
Reply With Quote
 
John Saunders [MVP]
Guest
Posts: n/a
 
      04-17-2007
"kirk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> John,
>
> 1) The solutions I was finding on the web were all based on the 1.1 and
> 1.0 framework. They involved tweaking the resource.cs file by overriding
> the WebRequest method and setting the KeepAlive = false. Basicly, force
> the creation of a new connection for every request. I guess that MS had a
> support item on it at
> 'http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b819450' but
> they have since removed the topic.
> I can't follow the recommend because in VS 2005, there is no resource.cs
> file any more. this file is generated on the fly by the .net framework
> after deployment.
>
> 2) the web service is configured for ssl using a purchased certificate.
> When my client hits my ws using https, my call to the 3rd party ws fails
> with the error stated. If I allow my client to hit my ws without ssl, my
> call to the 3rd party ws works just fine. In both cases I am hitting the
> 3rd party ws using ssl.


Your call to the 3rd party ws should be independent of how your ws was
called. The information that you were called over an SSL connection simply
should not be able to flow to the call on the 3rd party ws.

Unless, that is, you're doing something to couple the two. For instance, are
you using properties of the Request to set parameters for the call to the
3rd party ws? Look for any way that the information could be leaking from
the call to your client into the call to the other ws.
--
John Saunders [MVP]


 
Reply With Quote
 
kirk
Guest
Posts: n/a
 
      04-17-2007
John,

Thanks for the help. your last post prompted me to look deeper at what what
going on.
It turns out that I had a custom component I had written named security.dll
which was conflicting with another Security namespace used by the webserice
I was calling. I renamed the component and the namespaces in it,
recompiled, then after a little play got it working.
Again, thank you.

Kirk

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
news:eKcF%(E-Mail Removed)...
> "kirk" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> John,
>>
>> 1) The solutions I was finding on the web were all based on the 1.1 and
>> 1.0 framework. They involved tweaking the resource.cs file by overriding
>> the WebRequest method and setting the KeepAlive = false. Basicly, force
>> the creation of a new connection for every request. I guess that MS had
>> a support item on it at
>> 'http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b819450' but
>> they have since removed the topic.
>> I can't follow the recommend because in VS 2005, there is no resource.cs
>> file any more. this file is generated on the fly by the .net framework
>> after deployment.
>>
>> 2) the web service is configured for ssl using a purchased certificate.
>> When my client hits my ws using https, my call to the 3rd party ws fails
>> with the error stated. If I allow my client to hit my ws without ssl, my
>> call to the 3rd party ws works just fine. In both cases I am hitting the
>> 3rd party ws using ssl.

>
> Your call to the 3rd party ws should be independent of how your ws was
> called. The information that you were called over an SSL connection simply
> should not be able to flow to the call on the 3rd party ws.
>
> Unless, that is, you're doing something to couple the two. For instance,
> are you using properties of the Request to set parameters for the call to
> the 3rd party ws? Look for any way that the information could be leaking
> from the call to your client into the call to the other ws.
> --
> John Saunders [MVP]
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Established connection aborted and underlying connection closed Apu Nahasapeemapetilon ASP .Net Web Services 0 11-06-2006 04:24 PM
The underlying connection was closed (Windows2003, .net 1.1 sp1) Jack Wright ASP .Net 3 12-06-2004 04:37 AM
Problems migrating applicacion from Intranet to Internet. Underlying connection was closed. Luis Esteban Valencia ASP .Net 0 10-26-2004 01:01 PM
RE: System.Net.WebException: The underlying connection was closed: Steven Cheng[MSFT] ASP .Net 4 04-08-2004 08:07 AM
Underlying connection was closed sumit ASP .Net 0 11-01-2003 11:28 AM



Advertisments