JavaScriptSerializer问题 在本地执行不会出现以下错误,放到服务器上就有问题了,怎么?
2016-06-07 来自:鲲鱼鹏鸟 2 人回应

{"Message":"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}

有添加以下:

<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>

2016-06-08 来自:Ferris

应该是长度问题,需要设置一下最大长度吧

2016-06-07 来自:默小白

粗略看了下,是不是超过了最大序列化长度。

您的回应

你还未登陆,不能回应!登陆