A Confused Programmer's Blog

This blog is dedicated to C# and Java programming that I happen to do for living – with accent on curious cases and with sincere intent to make the world of coding a slightly better place as a result

WCF asynchronous actions and connection limits

I ran into curious issue that took me a while to sort out. We are using WCF 3.5 for interconnection between modules. Some of the commands return AsyncResult in order to be executed concurrently. I needed to write a code that executes 11 concurrent actions using WCF. Strangely, last action hanged and never arrived to the recipient module. This looked like WCF (mis-)configuration issue, and indeed it was so.

WCF asynchronous methods framework is a separate entity with complex logic and does not operate as regular methods do. For example, after BeginAction() is called, WCF seem to keep the connection open until the action is the completed for the given AsyncResult object. This is a WCF trace log that proves the thesis above – it took 30-60 seconds for the actions to complete, and for all this time the connection remained open (and not for couple of milliseconds it takes to create and return AsyncResult).

By default, WCF 3.5 enforces unreasonably low concurrent connection limit of 10. In WCF 4.0 it was raised to over than 100. Combination of this limit with necessity to keep connections alive for the duration of asynchronous execution resulted in eleventh request being denied the service. Here is the article that explains how to configure concurrent connections limit to fit your needs.

Also, I added maxConnections property to the binding element:

binding name = "MyBinding" receiveTimeout = "03:00:00" sendTimeout = "03:00:00" transferMode = "Buffered" maxBufferPoolSize = "31457280" maxBufferSize = "52428800" maxReceivedMessageSize = "52428800" maxConnections = "20"

But I am not sure that this is necessary.

Comments are closed.

Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

REST Assured and une

If you stumbled onto this article, it is safe to ...

Getting rid of Error

Since I upgraded my Windows 8 to Windows 10, I ...

Bypassing EULA step

We are working on automated testing of virtual appliance. This appliance ...

How I got rid of "Ac

OVF is a VMware virtual appliance format which allows you ...

My use-case of Perfo

In my blog I am set on a mission to ...

Twitter updates

RSS not configured