在我的数据网格设置中使用 extjs,我将代理 api 设置为...
api: {
read: '/Admin/BillRateData.aspx/Get?rbl=asd'
},
和我的网络方法...
public static List<Something> Get(string rbl)
Firebug 中的响应是……
{"Message":"Invalid JSON primitive: asd.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromGetRequest(HttpContext context, JavaScriptSerializer serializer, WebServiceMethodData methodData)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}
我发送的数据是这样的……当我发送信件时……</p>
MyParameter true _dc 1371570036523 limit 25 page 1 rbl asd start 0
当我发送一个号码时……</p>
MyParameter true _dc 1371570093718 限制 25 页 1 rbl 123 开始 0
但它不会在 webmethod 上达到我的断点,并且 JS 会抛出“读取操作失败:内部服务器错误”。但是,如果我将 url 更改为“rbl=123”,它就可以正常工作。它似乎只接受数值。这里发生了什么?!