Friday, June 26, 2009

WCF proxy cleanup

@YaronNaveh

When working with a WCF client proxy we need to close it after usage.
Failing to do so would of course affect our client performance. However it would also affect our server performance and in some cases might block new client from connecting to it. One example is when using sessions (which is the default wcf behavior): Since the open sessions number is limited a non-closed client might block a new client.

However the simple way of closing a client:


proxy.close();


is naive. The close may fail, for example due to the client not being able to release the session because of a server problem. For this reason we need to catch any possible exception.

Pablo perfectly explains how to do it.

@YaronNaveh

What's next? get this blog rss updates or register for mail updates!

0 comments: