首页新闻找找看学习计划

JavaScriptSerializer问题 在本地执行不会出现以下错误,放到服务器上就有问题了,怎么?

0
[已解决问题] 解决于 2017-04-20 11:28

{"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>

度郎的主页 度郎 | 初学一级 | 园豆:3
提问于:2016-06-07 10:46
< >
分享
最佳答案
0

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

奖励园豆:5
Jeffcky | 老鸟四级 |园豆:2544 | 2016-06-07 11:36
其他回答(1)
0

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

九九哥 | 园豆:182 (初学一级) | 2016-06-08 09:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册