问题
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".
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.
25,000 * 48.5 characters = 1,224,140 characters.
MS says that maxJsonLength is in terms of characters. Int32.MaxValue is over 2 billion. What gives?
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.
Many thanks in advance!
回答1:
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.
来源:https://stackoverflow.com/questions/12749229/invalidoperationexception-despite-maxjsonlength-int32-maxvalue