Proxy Caching Changes


I don't think I ever wrote about the changes made to WCF generated typed proxies in Orcas, although Wenlong had an article about the changes to proxy behavior back when they were made.

Generated proxies are the ones produced from the standalone client classes that are generated by tools such as svcutil. Internally, the generated proxy uses the other kind of typed proxy, the one created by instantiating a typed ChannelFactory. It's the ChannelFactory that actually knows about contracts, bindings, and the process of generating communication channels for exchanging messages with a web service. Initializing the ChannelFactory is a large portion of the expense of instantiating a proxy prior to the use of network resources.

In the original approach, instantiating a generated proxy would every time result in creating a new ChannelFactory. With this change, a cache of ChannelFactory objects was introduced so that if you're repeatedly instantiating similar proxy objects, the cost is much less. Of course, it would likely be even better for you to reuse proxies in your application code rather than rely on caching to make the creation of proxies cheaper. However, reusing proxies is something that would require changing individual applications while caching is something that we could do to make many applications faster.

Next time: Working with XElement Names

Comments (1)

  1. MSMQ reports many common errors using generic error messages. For example, opening a queue might give

Skip to main content