title: Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'
body: <p>I am get the above response when calling a WCF service via ajax json. My calling code is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $.ajax
          ({
              type: "POST",
              contentType: "application/json; charset=utf-8",
              url: "http://localhost:90/WebServices/UserService.svc/Calculate",
              data: "{}",
              timeout: 10000,
              dataType: "json",
              success: function (response) {
                  alert(response)
              },
              error: function (xhr, ajaxOptions, thrownError) {
                  alert(xhr.statusText);
                  alert(thrownError);
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>My service is:</p>
  
  <pre><code>[ServiceContract]
  public interface IUserService
  {
      [OperationContract]
      [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json
       )]
      Answer Calculate();
  }
  
  [DataContract]
  public class Answer
  {
      [DataMember]
      public string answer { get; set; }
  }
  </code></pre>
  
  <p>My method is :</p>
  
  <pre><code>[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
  public class UserService : IUserService
  {
      public Answer Calculate()
      {
          Answer answer = new Answer();
          answer.answer="Hello World";
          return answer;
      }
  }
  </code></pre>
  
  <p>I have been battling with for sometime, I see other people have had the same type problem and I tried all there suggestions but still nothing is working. </p>
  
  <p>Where is the problem? How can I solve it?</p>