Calling a WCF service from Silverlight using ChannelFactory

A lot of Silverlight applications using services are typically developed using the Add Service Reference dialog box to add service references that generate the client-side proxy classes. However, this isn't sufficient or advisable for some applications or pieces of code. You might want to call variable endpoints or you might be developing a library or a framework in which you wouldn't want to have service references for pluggability or for extension purposes (for example: through a provider pattern).

This is where a ChannelFactory comes in handy. Through a ChannelFactory, you can combine a binding and an address from code with a contract to open a channel to a service endpoint that implements ...

Get Silverlight 4 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.