title: WCF: How to actually get to use WSHttpBinding? I get exceptions instead
body: <p>I created a WCF Service:</p>
  
  <p><b>Shared.dll:</b></p>
  
  <pre><code>[ServiceContract(ConfigurationName = "ICalculator")]
  public interface ICalculator
  {
      [OperationContract()]
      int Add(int a, int b);
  }
  </code></pre>
  
  <p><b>Server:</b></p>
  
  <pre><code>[ServiceBehavior()]
  public class Calculator : ICalculator
  {
      public int Add(int a, int b) { return a + b; }
  }
  </code></pre>
  
  <p><b>Client (Attempt #1):</b></p>
  
  <pre><code>public class CalculatorClient : ClientBase&lt;ICalculator&gt;, ICalculator
  {
      private static Binding binding = new WSHttpBinding("MyConfig");
      private static EndpointAddress remoteAddress = new EndpointAddress(...);
  
      public CalculatorClient() : base(binding, remoteAddress) { }
  
      public int Add(int a, int b)
      {
          return Channel.Add(a, b); //Exception
      }
  }
  </code></pre>
  
  <p><b>Client (Attempt #2):</b> -- Note: I added a Service Reference instead of creating a CalculatorClient myself (.NET created it for me).</p>
  
  <pre><code>static void Main(string[] args)
  {
      Binding binding = new WSHttpBinding("MyConfig");
      EndpointAddress remoteAddress = new EndpointAddress(...);
      CalculatorClient client = new CalculatorClient(binding, remoteAddress);
      int result = client.Add(5, 4); //Exception
  }
  </code></pre>
  
  <p><b>Client (Attempt #3):</b> -- I changed it to be a BasicHttpBinding() instead</p>
  
  <pre><code>static void Main(string[] args)
  {
      Binding binding = new BasicHttpBinding("MyConfig");
      EndpointAddress remoteAddress = new EndpointAddress(...);
      CalculatorClient client = new CalculatorClient(binding, remoteAddress);
      int result = client.Add(5, 4); //This works!
  }
  </code></pre>
  
  <p><b>app.config:</b></p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsHttpBinding&gt;
          &lt;binding name="MyConfig" /&gt; &lt;!-- did not add anything to this yet --&gt;
        &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p><hr>
  The exception I get is: Content Type application/soap+xml; charset=utf-8 was not supported by service <a href="http://localhost/CalculatorService.svc" rel="nofollow">http://localhost/CalculatorService.svc</a>.  The client and service bindings may be mismatched. I don't see how they can be mismatched when I use a shared dll file between my server and client. The <code>BasicHttpBinding</code> works, just not the <code>WSHttpBinding</code> (I haven't even attempted <code>WS2007HttpBinding</code>.</p>
  
  <hr>
  
  <p>Exception: [<code>System.ServiceModel.ProtocolException</code>]
  {"Content Type application/soap+xml; charset=utf-8 was not supported by service <a href="http://localhost/CalculatorService.svc" rel="nofollow">http://localhost/CalculatorService.svc</a>.  The client and service bindings may be mismatched."}
  Inner Exception: [<code>System.Net.WebException</code>]
  The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..</p>