WCF client proxy initialization

Posted by 123Developer on Stack Overflow See other posts from Stack Overflow or by 123Developer
Published on 2009-11-05T16:29:03Z Indexed on 2010/06/18 11:03 UTC
Read the original article Hit count: 333

Filed under:
|
|

I am consuming a WCF service and created its proxy using the VS 2008 service reference.

I am looking for the best pattern to call WCF service method

  • Should I create the client proxy instance every time I call the service method and close the client as soon as I am done with that? When I profiled my client application, I could see that it is taking lot of time to get the Channel while initializing the proxy client
  • Should I use a Singleton pattern for the client proxy so that I can use the only once instance and get rid of the re-initializing overhead? Is there any hidden problem with this approach?

I am using .Net framework 3.5 SP1, basicHttp binding with little customization.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf