标签:c#
ASP.NET平台中,用JavaScriptSerializer将返回的数据序列化,若返回的数据非常大,则可能会报如下错误:
Exception information: Exception type: InvalidOperationException Exception message: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
解决办法如下:
在实例化JavaScriptSerializer对象后,指定MaxJsonLength。
System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); jss.MaxJsonLength = int.MaxValue;
C# JavaScriptSerializer报错,json数据太长
标签:c#
原文地址:http://blog.csdn.net/kangrydotnet/article/details/45693789