简体   繁体   English

使用JSON JavaScriptSerializer时发生错误“字符串的长度超过了在maxJsonLength属性上设置的值”

[英]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.

相关问题 字符串的长度超过maxJsonLength属性上设置的值 - length of the string exceeds the value set on the maxJsonLength property MVC4错误:字符串的长度超过了在maxJsonLength属性上设置的值 - MVC4 error: The length of the string exceeds the value set on the maxJsonLength property 错误“字符串的长度超过了 maxJsonLength 属性上设置的值。” - Error 'The length of the string exceeds the value set on the maxJsonLength property.' 字符串的长度超过maxJsonLength属性c上设置的值。 - The length of the string exceeds the value set on the maxJsonLength property.c# 字符串的长度超过了 mvc 中 maxjsonlength 属性上设置的值 - the length of the string exceeds the value set on the maxjsonlength property in mvc 正在检测字符串的长度超过在服务器上的maxJsonLength属性上设置的值 - Detecting The length of the string exceeds the value set on the maxJsonLength property at the server 我收到“字符串的长度超过 maxJsonLength 属性上设置的值” - I am getting a “The length of the string exceeds the value set on the maxJsonLength property” 尝试将部分视图转换为字符串时,“字符串的长度超出了在maxJsonLength属性上设置的值。” - “The length of the string exceeds the value set on the maxJsonLength property.” when trying to convert a partial view to string ASP.Net WebForm c#Web服务-字符串的长度超过在maxJsonLength属性上设置的值 - ASP.Net WebForm c# WebService - The length of the string exceeds the value set on the maxJsonLength property JavaScript中View转换ViewBag.JsonData时,得到 The length of the string exceeds the value set on the maxJsonLength property - While converting ViewBag.JsonData from View in JavaScript, getting The length of the string exceeds the value set on the maxJsonLength property
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM