Binary Http Binding

Do I need IIS7 to use binary with HTTP for WCF?

No, all you need is a custom binding because we don’t include a standard binding with that configuration out of the box.

Here’s a quick example of putting binary and HTTP together with either code or configuration:

BinaryMessageEncodingBindingElement encoding = new BinaryMessageEncodingBindingElement();
HttpTransportBindingElement transport = new HttpTransportBindingElement();
Binding binding = new CustomBinding(encoding, transport);
<binding name="BinaryHttpBinding">
<binaryMessageEncoding />
<httpTransport />

You could also make a subclass of Binding if you didn’t want to build a custom binding every time, but no special version of IIS is required.

Comments (3)
  1. William says:

    How do we make use of Windows Integrated Authentication with the new binaryMessageEncoding? I have not been able to get this to work. In SL2, we could use the basicHttpBinding with security mode set to "TransportCredentialOnly" and the transport clientCredentialType set to "Windows", and then we had the context of the windows user passed to the service. I would like to know how to do that with a BinaryMessageEncoding. Thanks!

  2. Hi William,

    Thanks for the report.  I’m following up with the Silverlight team to see if there are any known issues or steps needed to get binary working with Windows auth.

  3. Steve W wrote in to say:

    I had the same issue trying to get binary http encoding working with windows authentication and silverlight 3 – in the end it turns out to be fairly easy to solve – the config required is something like this:



                   <binding name="HttpBinaryBinding">

                           <binaryMessageEncoding />

                           <httpTransport authenticationScheme="Negotiate" />






                   <behavior name="default">

                           <serviceAuthorization impersonateCallerForAllOperations="false" />

                           <serviceDebug includeExceptionDetailInFaults="true" />





           <service behaviorConfiguration="default" name="Surveys.Services.SurveyService">

                   <endpoint address="" binding="customBinding" name="SurveyServiceBinaryHttpEndpoint" bindingConfiguration="HttpBinaryBinding" contract="Surveys.Services.ISurveyService" />



    The key is simply to use authenticationScheme="Negotiate" (or presumably something more specific) in the binding rather than trying to use the <security> element in the binding.

Comments are closed.

Skip to main content