我正在尝试创建 WCF 服务,但在进行 Ajax 调用时,我收到了从提琴手那里收到的以下错误。
The server encountered an error processing the request. The exception message is 'Error in deserializing body of request message for operation 'GetRecords'. OperationFormatter encountered an invalid Message body. Expected to find an attribute with name 'type' and value 'object'. Found value 'boolean'.'. See server logs for more details. The exception stack trace is:
有人可以解释错误以及可能是什么原因,因为我不确定这里可能出了什么问题。
我正在使用 POST 发送 ajax 请求。这是我的ajax请求:
var url = "webservices/mainGrid/Nick.svc/GetRecords"
var source = {
dataType: 'json',
url: url,
type: "POST",
id: "SEQUENCE",
root: 'rowsinfo',
contentType: "application/json; charset=utf-8",
async: false,
cache: false,
columns:[],
datafields:[],
beforeprocessing: function (data) {
var columnsdata = new Array();
var datafieldsdata = new Array();
for (k in data.columnsinfo){
var col={};
col.text = data.columnsinfo[k]["DISPLAYNAME"];
col.datafield = data.columnsinfo[k]["DISPLAYNAME"];
var datafields={};
datafields.name = data.columnsinfo[k]["DISPLAYNAME"];
columnsdata .push(col);
datafieldsdata .push(datafields);
source.columns = columnsdata;
source.datafields = datafieldsdata;
}
$("#jqxgrid").jqxGrid({columns : source.columns});
},
data: {
group: JSON.stringify(checkedGroups),
staff: JSON.stringify(checkedStaff),
MODULE: selectedModuleSEQ
}
};
有关错误的任何信息都会很好!谢谢