WCF返回400?


                    

我正在尝试创建WCF服务,但是遇到以下错误,该错误是我在进行Ajax调用时从提琴手那里得到的。</ p>

 服务器在处理请求时遇到错误。 异常消息为“对操作'GetRecords'的请求消息主体进行反序列化时出错。  OperationFormatter遇到无效的消息正文。 期望找到名称为“ type”且值为“ object”的属性。 发现值“布尔值”。 有关更多详细信息,请参见服务器日志。 异常堆栈跟踪为:
</ code> </ pre>

有人可以解释该错误,可能是什么原因,因为我不确定这里可能出什么问题。</ p>

我正在使用POST发送ajax请求。 这是我的Ajax请求:</ p>

  var url =“ webservices / mainGrid / Nick.svc / GetRecords”
var source = {
     dataType:'json',
     网址:url,
     输入:“ POST”,
     id:“ SEQUENCE”,
     根:“ rowsinfo”,
     contentType:“ application / json; charset = utf-8”,
     异步:错误,
     快取:false,
     列:[],
     数据字段:[],
     预处理:函数(数据){
         var columndata = new Array();
         var datafieldsdata = new Array();
         为(data.columnsinfo中的k){
             var col = {};
             col.text = data.columnsinfo [k] [“ DISPLAYNAME”];
             col.datafield = data.columnsinfo [k] [“ DISPLAYNAME”];
             var datafields = {};
             datafields.name = data.columnsinfo [k] [“ DISPLAYNAME”];
             columndata .push(col);
             datafields.push(datafields);
             source.columns = columndata;
             source.datafields = datafieldsdata;
         }
         $(“#jqxgrid”)。jqxGrid({columns:source.columns});
     },
         数据:{
             组:JSON.stringify(checkedGroups),
             员工:JSON.stringify(checkedStaff),
             模块:selectedModuleSEQ
             }
     };
</ code> </ pre>

有关该错误的任何信息都将是很好的! 谢谢</ p>
     </ div>

展开原文

原文

I am trying to create a WCF service but I am getting the following error which I have picked up from fiddler when making an Ajax call.

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:

Could someone explain the error and what could be the cause please as i'm not sure what could be going wrong here.

I am sending an ajax request using POST. Here is my ajax request:

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

Any information on the error would be good! thanks

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐