WCF Binary Bindings in Silverlight 3

One of the most common comments I hear form people when they start digging into Silverlight 3 Beta (and Silverlight 2) is the lack of WCF binding options. Some changes have been made to include binary encoding in Silverlight 3, so now we have:

  • customBinding
    • can do things like binary binding with WCF clients
    • new to Silverlight 3 Beta
  • basicHttpBinding
    • basic clear text binding
  • pollingDuplexHttpBinding
    • exactly what it says … a pseudo duplex basic binding that uses polling


Custom binding with binary encoding is nice if you want to do binary encoding of the message. In fact, this is the default binding that is created when you use a Silverlight enabled WCF file template in Visual Studio 2008 to create a WCF service. Binary encoding often offers performance gains over text encoding. Here is a quick glimpse at the config setup for the binding

            <behavior name="SilverlightApplication2.Web.Service1Behavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            <binding name="customBinding0">
                <binaryMessageEncoding />
                <httpTransport />
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <service behaviorConfiguration="SilverlightApplication2.Web.Service1Behavior"
            <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
                contract="SilverlightApplication2.Web.Service1" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />


There is a nice blog post from Yavor Georgiev, (Program Manager on the Connected Framework Team) that explains this in more detail. You can also view Eugene Ovosvetsky’s (also of Microsoft) presenting his Consuming Web Services in Silverlight 3 session at Mix 2009 … this session covers binary encoding as well as other new networking features.

Tweet Post Share Update RSS

Hi, I'm John Papa. I author this blog, create courses for Pluralsight and am a Google Developer Expert and Microsoft Regional Director. I travel speaking at events and train technology thought leaders