Application timing out on live (under load) when making WCF Calls

Had an issue with a maintenance release of a system this week to UAT; It was a new WCF web service which supplies valuation data about vehicles- adapted an existing system to consume this service instead of it’s original local database- it worked fine in dev, but on UAT under load testing everything worked perfectly… for about 10 minutes!

As soon as the client system got under load from multiple connections we begun seeing timeout exceptions and the application just generally hanging, but only on pages which made WCF calls to the new service. After some perusal of the ELMAH error logs it became apparent that it was indeed our implementation of the WCF clients to blame- a quick peek into the code revealed that we were creating the WCF service proxy client, then executing the method we wanted, but then NOT calling the .Close method against the proxy! So the first 16 connections (the default number of connections allowed with the stock WCF config) were coming in and everything went fine, but after that all the connections were used up, just hanging there still open!

So… don’t forget to close you connections when you’re done- especially if you’ve come from using ASMX services where you didn’t have to worry about such things!

  1. No comments yet.
(will not be published)