In one of my controller actions,when I return a more than 10000 rows JsonResult to the view. I will get the below exceptions.
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

I have setted the maxJsonLength property in the web.config to a higher value unfortunately does not show any effect like below:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644"/>
</webServices>
</scripting>
</system.web.extensions>
And I also set the MaxJsonLength when I used Json class like below:
public JsonResult GetList(GridPager pager, string queryStr)
{
List<SysExceptionModel> list = _exceptionBLL.GetList(ref pager, queryStr);
var json = new
{
total = pager.totalRows,
rows = list.ToArray()
};
var jsonresults = Json(json);
jsonresults.MaxJsonLength = int.MaxValue;
return jsonresults;
}
These two settings would not help me. I was confused.
one row is like below:
0000688A-85F5-4F72-BE86-85BCADED2DE NULL BBBB BBBB BBBB BBBB BBBB 2015-10-22 02:27:38.000
serializer.MaxJsonLength = Int32.MaxValue;before serializing data. Tryvar jsonresults = Json(json, JsonRequestBehavior.AllowGet);for code snippet.