Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

WCF; closing client

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 01-15-2007   #1 (permalink)
Marc Gravell
Guest


 

WCF; closing client

General question; WCF clients - do these (broadly) pool? My assumption
is "no".

Specifically, if I am expecting to perform additional requests
shortly, should I close the client and re-obtain when needed, or leave
it open and re-use it? I would lean towards the latter, unlike (for
instance) SqlConnections which I would generally close/dispose and let
the pool worry about it...

Even if it doesn't pool, is the overhead significant in closing each
time versus re-using?

Cheers,

Marc




My System SpecsSystem Spec
Old 01-15-2007   #2 (permalink)
Marc Gravell
Guest


 

Re: WCF; closing client

additional; relating in particular to IIS-hosted "svc" style services,
using transport encryption and without any security negotiations [for
compatibility with existing systems, security handled via bespoke
extensions / headers]

Marc


My System SpecsSystem Spec
Old 01-17-2007   #3 (permalink)
Joerg Jooss
Guest


 

Re: WCF; closing client

Thus wrote Marc,

> General question; WCF clients - do these (broadly) pool? My assumption
> is "no".


That's right. Closing the client prematurely can also terminate a session
or a secure conversation, which is quite expensive to establish.

> Specifically, if I am expecting to perform additional requests
> shortly, should I close the client and re-obtain when needed, or leave
> it open and re-use it? I would lean towards the latter, unlike (for
> instance) SqlConnections which I would generally close/dispose and let
> the pool worry about it...


In this scenario (and especially when using more expensive binding features)
you should reuse your clients, but also monitor their states closely using
the lifecycle events of ClientBase<T>. Once a client has faulted, call Abort()
on it to avoid leaking resources, and replace it with a fresh instance. See
http://msdn2.microsoft.com/en-us/library/ms734653.aspx for further details.

Cheers,
--
Joerg Jooss
news-reply@joergjooss.de


My System SpecsSystem Spec
Old 01-17-2007   #4 (permalink)
Marc Gravell
Guest


 

Re: WCF; closing client

Thankyou - I think that confirms my thoughts... unfortunately the
"always close" warning on generated classes doesn't make this very
clear ;-p

Cheers,

Marc


My System SpecsSystem Spec
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing WLM Jane Doe Live Mail 7 05-27-2008 01:13 PM
Closing a DVD-RW BobC Vista General 0 02-06-2008 01:00 PM
DEP keeps closing IE7, what's gives? Mesquire Vista security 11 11-17-2007 09:36 AM
Windows Mail keeps closing because DEP is closing for security Window Mail DEP message Vista mail 7 05-23-2007 05:59 AM
closing lid =?Utf-8?B?c2F1LmJhZXI=?= Vista General 2 09-22-2006 11:07 AM


Update your Vista Drivers Update Your Vista Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008
Page generated in 0.25349 seconds with 10 queries