Silverlight 3 Beta and Binary message encoding
Silverlight 3 Beta uses Binary message encoding as a default WCF binding option, this is also the methodology used in the “Silverlight-enabled WCF Service” item template of Visual Studio.
John Papa has posted a nice article explaining the advantages of this binding instead of the “usual” BasicHttpBinding used in Silverlight 2 (other details available here and here), what about the client side? How can I use this new Binding?
These are the steps required for explicitely specifying the new binding in the code:
-
add a “Service Reference” from Visual Studio;
-
initialize and call the service in this way
EndpointAddress address = new EndpointAddress("<Your Service Uri Here>"); CustomBinding binding = new CustomBinding( new BinaryMessageEncodingBindingElement(), new HttpTransportBindingElement()); YourServiceRef.ServiceClient svc = new YourServiceRef.ServiceClient(binding, address);
Download the Visual Studio 2008 solution (also tested on Visual Studio 2010 Beta 1:)



