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

G

Gaetan

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?
 
M

Michael D. Ober

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.
 
G

Gaetan

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.
 
A

Adrian H

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top