This article transferred from: http://blog.csdn.net/blacksource/article/details/18797055
Let's start with a brief introduction to the project:
The whole project was developed using Microsoft's ASP. NET MVC3, the front-end display uses the Easyui frame, the chart display uses the Highcharts, mainly carries on the plot of the graph, thus the comparison vividly depicts the change trend. Because the data volume is large (greater than 1000,000 Records), and the data type accepted by Highcharts is in JSON format, the data that the controller takes out of the database needs to be formatted as JSON before being uploaded to the front end. Always use MVC json () to serialize the data into JSON format, but because of this large amount of data, so the curve is not displayed, so always thought it is due to the large amount of data, highcharts plug-in does not support 100w data, Later heard that the highcharts itself is to support 100w-level data. Finally, using Firebug debugging, we found an error: "There was an error serializing or deserializing using JSON javascriptserializer." The length of the string exceeds the value set for the Maxjsonlength property "and many solutions have been found on the web, with almost no exception being added under the node for Web. config:
<system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="1024000000" /> </webServices> </scripting></system.web.extensions>
After trying to find the curve still did not come out, finally took out the killer: Google translated into English, re-search, finally found a solution to the StackOverflow on the law:
public ActionResult GetLargeJsonResult(){ return new ContentResult { Content = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }.Serialize(myBigdata), ContentType = "application/json" };}
Specific website: http://stackoverflow.com/questions/4155014/json-asp-net-mvc-maxjsonlength-exception
Here have to praise StackOverflow, a lot of problems are found in the above solution, and there are a lot of good-hearted people who are enthusiastic and meticulous to answer questions, I mentioned a number of issues have finally been so-called geek help and resolved. Here, I just want to say: Thank you.
Go ASP. NET MVC JSON () handles big Data exception resolution JSON Maxjsonlength