Managing instance lifecycle of WCF client

Is it OK to store a WCF client instance on a singleton to use on the whole appdomain? Also are you suppose to manage the state of the client because I see it has a Close and Open method?

Answers


I would not store it as a singleton. If you do and it ends up in a Faulted state, you'll have some trouble. Use it as an instance, and properly Close and Dispose of it.


Need Your Help

Passing a reference to a variable

c++ mfc

I get an error stack around variable dlgFile is corrupted which I am trying to fix. This is legacy code and it looks dubious. I replaced part of in another project which is here:

C#, Is it possible to recast an object and access methods and properties without creating new object variable

c# object methods casting

C#, Is it possible to recast an object and access methods and properties without creating new object variable?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.