HTTP 500 - The length of the string exceeds the value set on the maxJsonLength property-

500 Internal Server Error :

Error Message :

"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."

ExceptionType :

"System.InvalidOperationException"

Stack Trace :

"   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)"


Fix/Workaround/Solution:

To fix this problem you can add following to web.config:


<configuration>

<system.web.extensions>

   

 </system.web.extensions>

</configuration>