Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our application includes an ASP.Net web service that only needs to deal with a handful of clients. As such, the 10 incoming connection limit of Windows XP Pro is generally not a problem. However, on one particular server, connections are occasionally becoming stuck in the CLOSE_WAIT state. These connections build up over time and eventually new client connections are refused because the maximum number of connections are used up.

From my googling it sounds like a failure of the webservice to properly close the connection can cause this problem, but as it works just fine on hundreds of other Windows XP pro machines I can't see it being a bug in our code. It also ran fine on the affected machine until some shenanigans on the part of the end user (I think they set about deleting duplicate files in order to reduce their disk usage, but they did not exactly come clean about it).

What could the user have changed to introduce this problem? Is there any way I can force connections that are in CLOSE_WAIT to time out rather than letting them hang around? I have seen suggestions to reduce TcpTimedWaitDelay, but that only relates to the TIME_WAIT state, and changing it did not have any effect.

share|improve this question
I discovered that behaviour for a Windows 2008 R2 Server that runs inside Citrix Xen and has updated the Xen Citrix Tools for Virtual Machines to a newer version. I also found this forum post to suggest to adjust the KeepAliveTime – Uwe Keim Jun 14 '13 at 3:55
up vote 0 down vote accepted

An issue like that is usually code related with objects that need to be closed and disposed, but your story suggests that it's not in this case. I would check your connection timeout on the Web Site tab for the website. The default is 120 seconds. If that has been raised then it may keep more connections around than on your other machines.

Also check the IIS logs to see if you have unusual traffic. If you have bots or something else visiting your site more often, you may be reaching the connection limits earlier than in the past.

share|improve this answer
Good tip, thanks. The timeout for the website was set to 900 seconds (15 minutes). I reduced it to the default and the connections started to drop off after a few minutes. I suppose what this would indicate is that rather than accumulating over weeks (as I thought), the connections are just becoming maxed out during busy periods that require more than ten connections within 15 minutes. – randomhuman Mar 18 '11 at 11:06
I don't think this is the entire story though, because I checked a few other clients PCs and they also had the timeout set to 900, but do not have this problem. I will keep an eye on it with the reduced timeout anyway. – randomhuman Mar 18 '11 at 11:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.