Search code examples
wcfproxyclientauto-generate

WCF client proxy keep alive?


It there any disadvantage of creating a wcf client in code everytime a call is needed. currently i have a static class that creates a client and reuses it for a period of time (couple of minutes before the wcf service times out)

i'm having problems with it getting into a faulted state while i'm in development because i keep recompiling the WCF code. its an annoyance now but think it'll be fine in production.

but... creating client proxy with user creds everytime a call is made... bad practice? performance issues?


Solution

  • I think the best answer is a little of both.

    there is definitely a performance hit creating a proxy client every call. if you can create a proxy client and use it for all the calls you're going to make immediately. then dispose of it. it is much faster.