[英]Error when using JSON JavaScriptSerializer “The length of the string exceeds the value set on the maxJsonLength property”
I am using JavascriptSerializer within my C# code and I am getting an error that string value exceesa maxJSonLength. 我在C#代码中使用JavascriptSerializer,但收到一个字符串值exceesa maxJSonLength的错误。 My object is filled from the database datatable that returns more than 50K rows. 我的对象是从数据库数据表中填充的,该数据表返回了超过5万行。 I tried changing maxJsonLength property in my App.Config file but the error does not go away. 我尝试更改App.Config文件中的maxJsonLength属性,但该错误不会消失。 Please help 请帮忙
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="5000000000"/>
</webServices>
</scripting>
</system.web.extensions>
Just in case, here is my C# code: 以防万一,这是我的C#代码:
List<MyRecord> lst= ...;
string strJSON = new JavaScriptSerializer().Serialize(lst);
maxJsonLength
属性的类型为int
,因此其值不能超过Int32.MaxValue
,即2147483644。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.