TCP/IP port exhaustion - Unable to connect to the remote server

Discussion in 'ASP .Net Web Services' started by Gaetan, Aug 16, 2007.

  1. Gaetan

    Gaetan Guest

    I have a web service client application that works fine when the requests rate is moderate. But when
    I crank up the request rate, I eventually receive an "Unable to connect to the remote server"
    exception.

    Running the "netstat -n" command at that point, I determined that all the TCP/IP ports in the range
    of 1025-5000 were in a TIME-WAIT state. Although this article refers to BizTalk
    (http://msdn2.microsoft.com/en-us/library/aa560610.aspx) I experience the exact same results.

    Is there a way to have the client side of a WebService request to re-use the same TCP/IP connection
    for every request sent to a given remote host?
     
    Gaetan, Aug 16, 2007
    #1
    1. Advertising

  2. What you are experiencing is a Denial of Service situation. The MSDN
    article you referenced tells you exactly what needs to be done to alleviate
    this issue. IP ports are numbered from 1 to 65534 and port numbers below
    1000 are usually reserved for server applications for the initial
    connection. Windows, by default, only uses ports 1000 to 5000 to satisfy
    connection requests. This leaves 60534 ports "available" but never used by
    Windows for this purpose.

    Assuming your client isn't initiating and then ignoring the response from
    the server, thus generating what's known as a SYN attack, and also properly
    closing the socket when done (Article Fix Option 1), you need to increase
    the number of ports on the server (Article Fix Option 2). I would also
    consider reducing the socket timeout as described in Article Fix Option 3
    if, and only if, you increase the ports to the maximum and are still having
    this error.

    For more information on this, please post in a Windows Server NG as this
    issue is not really a .NET issue.

    Mike Ober.

    "Gaetan" <> wrote in message
    news:...
    >I have a web service client application that works fine when the requests
    >rate is moderate. But when
    > I crank up the request rate, I eventually receive an "Unable to connect to
    > the remote server"
    > exception.
    >
    > Running the "netstat -n" command at that point, I determined that all the
    > TCP/IP ports in the range
    > of 1025-5000 were in a TIME-WAIT state. Although this article refers to
    > BizTalk
    > (http://msdn2.microsoft.com/en-us/library/aa560610.aspx) I experience the
    > exact same results.
    >
    > Is there a way to have the client side of a WebService request to re-use
    > the same TCP/IP connection
    > for every request sent to a given remote host?
    >
     
    Michael D. Ober, Aug 17, 2007
    #2
    1. Advertising

  3. Gaetan

    Gaetan Guest

    Thank you Michael for taking the time to reply. I read the article many times and I am aware of the
    ways to improve the situation.

    I took over someone else client side code written in C# and I'm afraid, .Net Web Services is not my
    forte. The code reads a file containing about 200,000 requests to be sent to a web application. For
    testing right now, the client code and the web application is on the same server.

    I think this forum is the right one, As the last statement of my original post indicates, I want to
    know whether it is possible with .Net Web Service to reuse the same connection (port) for every
    request.
     
    Gaetan, Aug 17, 2007
    #3
  4. Gaetan

    Adrian H Guest

    Re: TCP/IP port exhaustion - Unable to connect to the remote serve

    Your connections are probably eaten by NTLM authentication and not the HTTP
    requests. If your web service executes each of the requests using the same
    Windows credentials then you can probably turn on
    UnsafeAuthenticatedConnectionSharing which will prevent your application from
    authenticating for all subsequent requests. This will save you one socket per
    each request.

    "Gaetan" wrote:

    > Thank you Michael for taking the time to reply. I read the article many times and I am aware of the
    > ways to improve the situation.
    >
    > I took over someone else client side code written in C# and I'm afraid, .Net Web Services is not my
    > forte. The code reads a file containing about 200,000 requests to be sent to a web application. For
    > testing right now, the client code and the web application is on the same server.
    >
    > I think this forum is the right one, As the last statement of my original post indicates, I want to
    > know whether it is possible with .Net Web Service to reuse the same connection (port) for every
    > request.
    >
     
    Adrian H, Aug 23, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page