Re: Underlying connection was closed

From: Sachin (sachin_spam_protect__at_rcsworks.com)
Date: 10/25/04


Date: Mon, 25 Oct 2004 16:36:50 -0400

Here’s my problem stack trace
The underlying connection was closed: The request was canceled. at
System.Net.HttpWebRequest.CheckFinalStatus()
    at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
asyncResult)
    at System.Net.HttpWebRequest.GetRequestStream()
    at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
    at MyWebService.WebMethod1()

I get this error intermittently.

The most popular fix posted for the problem is to set KeepAlive = false…
but that wasn’t working for me.

Infact as suggested by Daniel I did a netStat –p TCP and found that I
had plenty of connections in TIME_WAIT state with the KeepAlive set to
false. If I remove that, I get a lot fewer connections in TIME_WAIT state.

But I still intermittently see this issue. What does the stack trace
tell anyone?

I really don’t know what going on with this. Hopefully someone can help!

* Remove _spam_protect_ to contact

Daniel Roth [MSFT] wrote:

> Hello,
>
> Did you try checking on the number of connections in the TIME_WAIT state using the netstat command I mentioned earlier? Also could you please confirm for me that you
> are seeing exaclty the same error message?
>
> Thank you for your patience.
>
> Daniel Roth
>
> --------------------
> From: meetarpan@gmail.com (AShah)
> Newsgroups: microsoft.public.dotnet.framework.webservices
> Subject: Re: Underlying connection was closed
> Date: 18 Sep 2004 19:34:52 -0700
> Organization: http://groups.google.com
> Lines: 211
> Message-ID: <c03bfe96.0409181834.e7d7b46@posting.google.com>
> References: <999e01c48637$da5519b0$a601280a@phx.gbl> <npRxjW8iEHA.1968@cpmsftngxa10.phx.gbl> <BImKiUFjEHA.2968@cpmsftngxa10.phx.gbl>
> <17f801c48c6d$e0cdbcc0$a601280a@phx.gbl> <T3E0GBvjEHA.1088@cpmsftngxa10.phx.gbl>
> NNTP-Posting-Host: 207.218.120.108
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 8bit
> X-Trace: posting.google.com 1095561292 20360 127.0.0.1 (19 Sep 2004 02:34:52 GMT)
> X-Complaints-To: groups-abuse@google.com
> NNTP-Posting-Date: Sun, 19 Sep 2004 02:34:52 +0000 (UTC)
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!
> nntp.giganews.com!news.glorb.com!postnews1.google.com!not-for-mail
> Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.webservices:6674
> X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
>
> Did you get solution to this problem ? I am seeing exactly the same
> problem when I load my system with many HTTP requests.
>
> daroth@online.microsoft.com (Daniel Roth [MSFT]) wrote in message news:<T3E0GBvjEHA.1088@cpmsftngxa10.phx.gbl>...
>
>>You might be getting the "The underlying connection was closed. Unable to connect to the remote server" error because
>>too many connections are in the TIME_WAIT state. When this happens the system may run out of the random port range.
>>Clearing the KeepAlive flag might actually be aggravating this situation.
>>
>>Please try entering "netstat -p TCP" at the command prompt and see how many TIME_WAIT connections are found.
>>
>>Also, do you have code that we could use to reproduce these errors for further investigation?
>>
>>Thank you for your patience.
>>
>>Daniel Roth
>>
>>
>>
>>--------------------
>>Content-Class: urn:content-classes:message
>>From: "Rajeev Tipnis" <rtipnis@convoq.com>
>>Sender: "Rajeev Tipnis" <rtipnis@convoq.com>
>>References: <999e01c48637$da5519b0$a601280a@phx.gbl> <npRxjW8iEHA.1968@cpmsftngxa10.phx.gbl>
>><BImKiUFjEHA.2968@cpmsftngxa10.phx.gbl>
>>Subject: RE: Underlying connection was closed
>>Date: Fri, 27 Aug 2004 12:41:42 -0700
>>Lines: 170
>>Message-ID: <17f801c48c6d$e0cdbcc0$a601280a@phx.gbl>
>>MIME-Version: 1.0
>>Content-Type: text/plain;
>> charset="iso-8859-1"
>>Content-Transfer-Encoding: 7bit
>>X-Newsreader: Microsoft CDO for Windows 2000
>>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>>thread-index: AcSMbeDGoXHBF+5uQYaTicjNqvUzdQ==
>>Newsgroups: microsoft.public.dotnet.framework.webservices
>>Path: cpmsftngxa10.phx.gbl
>>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.webservices:6386
>>NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
>>X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
>>
>>
>>Hi Daniel -
>>Thanks for looking into this.
>>
>>When you say, this patch applied to 1.1, do you mean we
>>still need to get this patch (if we already have 1.1)?
>>In any case, we are in the process of getting this patch.
>>
>>However, what I dont understand is - how can the
>>configuration be incorrect as this happens
>>only "intermittently".
>>
>>So, in my load test case, I have a load test application
>>that runs against a web service. When the number of
>>simultaneous connections go over 20-25 range to the web
>>service, we begin to see these errors.
>>
>>In my case the scenario is as follows:
>>Two separate machines:
>>1. Web Services Client (for load testing):
>> A simple .net console app (.NET 1.1 Framework)
>>2. Web Services Server:
>> A .Net web service hosted on IIS 6.0 (on Win2K3)
>>on .NET 1.1 Framework.
>>
>>I start to see these errors when the load goes
>>beyond a certain threshold (about 25 connections, I
>>believe are open at that point).
>>
>>What I have experimented with so far:
>>- Cleared the keep-alive flag on the IIS and on the
>>client by overriding the client proxy methods
>>- IIS 6.0 is configured to receive unlimited connections
>>and configured to have really long timeouts
>>
>>If the configuration was incorrect, I would expect that
>>this would fail each time, but it fails with these errors
>>only under load.
>>
>>Thanks in advance.
>>
>>Rajeev
>>
>>
>>
>>>-----Original Message-----
>>>Hi Rajeev,
>>>
>>>I've answered your questions below:
>>>
>>>1) I believe this patch does apply to .Net 1.1.
>>>2) No, it does not solve the other cases since they are
>>
>> mostly a result of user configuration problems.
>>
>>>3) Yes, the fix does apply when the client is not an
>>
>> ASP.NET client.
>>
>>>For the issues you are having, you should verify that
>>
>>your proxy settings are correct and that you are
>>correctly specifying a valid server. Quite possibly
>>these two issues
>>
>>>are related. If you are still having these problems, I
>>
>> might be able to help if you provide some more details.
>>
>>>Let me know if you have further questions.
>>>
>>>Daniel Roth
>>>
>>>
>>>--------------------
>>>X-Tomcat-ID: 809948391
>>>References: <999e01c48637$da5519b0$a601280a@phx.gbl>
>>>MIME-Version: 1.0
>>>Content-Type: multipart/alternative; boundary="----
>>
>> =_NextPart_0001_6ADD76EC"
>>
>>>Content-Transfer-Encoding: 7bit
>>>From: daroth@online.microsoft.com (Daniel Roth [MSFT])
>>>Organization: Microsoft
>>>Date: Thu, 26 Aug 2004 23:37:23 GMT
>>>Subject: RE: Underlying connection was closed
>>>X-Tomcat-NG:
>>
>> microsoft.public.dotnet.framework.webservices
>>
>>>Message-ID: <npRxjW8iEHA.1968@cpmsftngxa10.phx.gbl>
>>>Newsgroups: microsoft.public.dotnet.framework.webservices
>>>Lines: 120
>>>Path: cpmsftngxa10.phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
>>
>> microsoft.public.dotnet.framework.webservices:6375
>>
>>>NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
>>>
>>>Hi Rajeev,
>>>
>>>I am in the process of investigating your questions. I
>>
>> will get back to you as soon as I have an answer.
>>
>>>Daniel Roth
>>>
>>>--------------------
>>>Content-Class: urn:content-classes:message
>>>From: "Rajeev Tipnis" <rtipnis@convoq.com>
>>>Sender: "Rajeev Tipnis" <rtipnis@convoq.com>
>>>Subject: Underlying connection was closed
>>>Date: Thu, 19 Aug 2004 14:59:51 -0700
>>>Lines: 23
>>>Message-ID: <999e01c48637$da5519b0$a601280a@phx.gbl>
>>>MIME-Version: 1.0
>>>Content-Type: text/plain;
>>> charset="iso-8859-1"
>>>Content-Transfer-Encoding: 7bit
>>>X-Newsreader: Microsoft CDO for Windows 2000
>>>Thread-Index: AcSGN9pVbhl3R/z4Q7iWwoav0NPNXg==
>>>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>>>Newsgroups: microsoft.public.dotnet.framework.webservices
>>>Path: cpmsftngxa10.phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
>>
>> microsoft.public.dotnet.framework.webservices:6290
>>
>>>NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
>>>X-Tomcat-NG:
>>
>> microsoft.public.dotnet.framework.webservices
>>
>>>http://support.microsoft.com/default.aspx?scid=kb;en-
>>>us;819450
>>>
>>>Questions:
>>>1) Is this patch (fix) applicable to the .NET 1.1
>>>Framework as well? That is, if we have Framework 1.1 (On
>>>Win2K3/IIS6.0), do we still need this patch?
>>>
>>>2) Does it specifically solve only this error:
>>>The underlying connection was closed. An unexpected
>>
>> error
>>
>>>occured on send.
>>>and not these (which is what we are seeing):
>>>
>>>- The underlying connection was closed. Unable to
>>
>> connect
>>
>>>to the remote server. OR
>>>- The underlying connection was closed. The proxy name
>>>could not be resolved, verify correct proxy
>>
>> configuration.
>>
>>>3) Would this not happen when the webservices client is
>>>not an ASP.NET client?
>>>
>>>Thanks
>>>Rajeev
>>>
>>>
>>>
>>>--
>>>
>>>This posting is provided "AS IS" with no warranties, and
>>
>>confers no rights. Use of included script samples are
>>subject to the terms specified at
>>
>>>http://www.microsoft.com/info/cpyright.htm
>>>
>>>Note: For the benefit of the community-at-large, all
>>
>>responses to this message are best directed to the
>>newsgroup/thread from which they originated.
>>
>>>
>>>
>>>--
>>>
>>>This posting is provided "AS IS" with no warranties, and
>>
>>confers no rights. Use of included script samples are
>>subject to the terms specified at
>>
>>>http://www.microsoft.com/info/cpyright.htm
>>>
>>>Note: For the benefit of the community-at-large, all
>>
>>responses to this message are best directed to the
>>newsgroup/thread from which they originated.
>
>
>
>



Relevant Pages

  • Re: Underlying connection was closed
    ... Did you try checking on the number of connections in the TIME_WAIT state using the netstat command I mentioned earlier? ... problem when I load my system with many HTTP requests. ... > configuration be incorrect as this happens ... > client by overriding the client proxy methods ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Underlying connection was closed
    ... When ever I load my application with many requests I ... > Daniel Roth ... > configuration be incorrect as this happens ... > client by overriding the client proxy methods ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Underlying connection was closed
    ... problem when I load my system with many HTTP requests. ... > Daniel Roth ... > configuration be incorrect as this happens ... > client by overriding the client proxy methods ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: Fedora core 1 sendmail problems
    ... > know that traffic on port 80 is coming in and out. ... initial posting - the same configuration did run before with RH 7.3 as ... meanwhile done by many provider for dialup connections to pretect agains ... work through port 80 to the Sendmail on your Fedora is running fine. ...
    (Fedora)
  • Re: Client End Firewalls
    ... depending on the firewall's configuration). ... Even if a client side firewall was to block just one ... Using a firewall with password protection is a must. ... >> connections. ...
    (Security-Basics)