尽管MaxJsonLength = Int32.MaxValue出现InvalidOperationExceptionMaxJsonLength、InvalidOperationException、M

由网友(29.爱情真让人烦)分享简介:我不认为我超过MaxJsonLength,但我仍然得到期间使用JSON JavaScriptSerializer序列化和反序列化时出错。字符串的长度超过上maxJsonLength属性设置的值。I don't think I'm exceeding the MaxJsonLength, but I'm still g...

我不认为我超过MaxJsonLength,但我仍然得到期间使用JSON JavaScriptSerializer序列化和反序列化时出错。字符串的长度超过上maxJsonLength属性设置的值。

I don't think I'm exceeding the MaxJsonLength, but I'm still getting "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property".

我检查,看看结果是怎么长的,它拥有25,000名行。我检查每一行的平均长度通过输出一个较小的结果,平均行是48.5个字符长。

I checked to see how long the result is, and it's 25,000 rows. I checked the average length of each row by outputting a smaller result, and the average row is 48.5 characters long.

25000 * 48.5字符= 1224140字。

25,000 * 48.5 characters = 1,224,140 characters.

MS说maxJsonLength是在字符的条款。 Int32.MaxValue超过2十亿。是什么给了?

MS says that maxJsonLength is in terms of characters. Int32.MaxValue is over 2 billion. What gives?

请注意:我不使用MVC,这是用VB编写的2010交谈jQuery的一个WebMethod。该结果是使用词典有组织的阵列。我得到的结果较小的集就好了。我证实,我的串行的maxJsonLength设置为最大值。

Note: I'm not using MVC, and this is a WebMethod written in VB 2010 talking to jQuery. The results are organized using a dictionary array. I get results for smaller sets just fine. I confirmed that my serializer's maxJsonLength was set to max.

提前感谢!

推荐答案

在ASP.NET有1000 JSON成员反序列化一个默认的最大值。据介绍,去年十二月。看看这是问题与您的应用程序。 这里有一篇文章这样。

In ASP.NET there is a default max value of 1000 JSON members for deserialization. It was introduced last December. See if this is the issue with your application. Here's an article for this.

阅读全文

相关推荐

最新文章