Não é possível processar a mensagem porque o tipo de conteúdo 'application / json; charset = utf-8 'não era o tipo esperado' text / xml; charset = utf-8 '

Eu recebo a resposta acima ao chamar um serviço WCF via ajax json. Meu código de chamada é:

<script type="text/javascript">
    $(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);
            }
        });
    });
</script>

Meu serviço é:

[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; }
}

Meu método é:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class UserService : IUserService
{
    public Answer Calculate()
    {
        Answer answer = new Answer();
        answer.answer="Hello World";
        return answer;
    }
}

Eu tenho lutado por algum tempo, vejo outras pessoas tiveram o mesmo problema de tipo e tentei todas as sugestões, mas ainda nada está funcionando.

Onde está o problema? Como posso resolver isso?

questionAnswers(2)

yourAnswerToTheQuestion