The ChannelAdam WCF Library is an open source (Apache License 2.0) full .NET Framework code library that handles the subtleties of consuming services using Microsoft’s Windows Communication Foundation (WCF) library - including correctly performing the Close/Abort pattern and preventing memory and server connection leaks.
The issues faced by .NET developers are explained in depth in the article How To Call WCF Services Properly, where I researched and highlighted the typical problems with using WCF clients (such as memory and connection leaks), and concluded that the most correct solution for consuming WCF services would:
- Perform the Close/Abort pattern without a race condition;
- Handle the situation when the service operation throws exceptions;
- Handle the situations when both the
Abortmethods throw exceptions; and
- Handle asynchronous exceptions such as the
The ChannelAdam WCF Library is designed to make your life as a developer easier when consuming WCF services, by abstracting away the complexities of service channel state transitions and the odd behaviour of the Microsoft WCF libraries that do not comply with even their own design guidelines.
In doing this, the ChannelAdam WCF
ServiceConsumer once and for all prevents memory and connection leaks, gives developers the ability to plug in their own strategies for handling different situations (such as logging exceptions), and provides a built-in mechanism to retry service operation calls when transient faults occur.