415 Unsupported Media Type Calling WCF Service from $.ajax

Viewed 8324

I am attempting to call a WCF web service from an ASPX page like so:

var payload = {
    applicationKey: 40868578
};

$.ajax({
    url: "/Services/AjaxSupportService.svc/ReNotify",
    type: "POST",
    data: JSON.stringify(payload),
    contentType: "application/json",
    dataType: "json"
});

Doing so results in the web server returning the error 415 Unsupported Media Type. I'm sure this is a configuration issue with the WCF service which is defined as follows:

[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json)]
void ReNotify(int applicationKey);

There are no entries in the web.config file so assume that the service uses the default configuration.

1 Answers
Related