title: How to use custom binding in WCF and keep message security mode with username client credentials?
body: <p>I have WCF service accessible over Internet which uses wsHttpBinding with message security mode and username client credentials.</p>
  
  <pre><code>&lt;bindings&gt;
      &lt;wsHttpBinding&gt;
          &lt;binding name="wsHttpEndpointBinding" messageEncoding="Mtom" maxReceivedMessageSize="104857600"&gt;
             &lt;readerQuotas maxArrayLength="104857600"/&gt;
             &lt;security mode="Message"&gt;
              &lt;message clientCredentialType="UserName"/&gt;
             &lt;/security&gt;
          &lt;/binding&gt;
      &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  </code></pre>
  
  <p>I've figured out that it takes too much time to transfer my data from client to the server.
  I've read that i can use customBinding and binaryEncoding mode for my service.</p>
  
  <p>Like that: </p>
  
  <pre><code>&lt;bindings&gt;
     &lt;customBindings&gt;
       &lt;binding name="NetHttpBinding"&gt;
         &lt;binaryMessageEncoding /&gt;
         &lt;httpTransport /&gt;
       &lt;/binding&gt;
    &lt;/customBindings&gt;
  &lt;bindings&gt;
  </code></pre>
  
  <p>But here is no any mention about message security mode and client credential type...</p>
  
  <p>How could i use custom binding with binaryEncoding and keep message security mode with username client credentials?</p>