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

2 posts, 0 answers
  1. Neha
    Neha avatar
    5 posts
    Member since:
    Mar 2012

    Posted 13 Jul 2012 Link to this post

    Hello,

    I have a web application that uses RadTreeView control for displaying data. When displaying large amount of data, it throws following error:

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

    I have tried changing "maxJsonLength" property to value 2147483646 in web.config of the application. But still above error appears.
    Please help.


    Detailed error is as follows:
    Timestamp: 7/13/2012 2:14:51 PM$$$Message: <?xml version="1.0" encoding="utf-16"?><error><message>Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.</message><stackTrace>   at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)    at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj)    at Telerik.Web.UI.RadTreeView.DescribeComponent(ScriptComponentDescriptor descriptor)    at Telerik.Web.UI.RadDataBoundControl.Telerik.Web.IControl.DescribeComponent(ScriptComponentDescriptor descriptor)    at Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(Control control)    at Telerik.Web.UI.RadDataBoundControl.GetScriptDescriptors()    at Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IScriptControl.GetScriptDescriptors()    at System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl)    at System.Web.UI.ScriptManager.RegisterScriptDescriptors(IScriptControl scriptControl)    at Telerik.Web.UI.RadDataBoundControl.RegisterScriptDescriptors()    at Telerik.Web.UI.RadDataBoundControl.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer)    at Telerik.Web.UI.RadMultiPage.RenderContents(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)    at Telerik.Web.UI.RadMultiPage.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer)    at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)    at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)    at ASP.master_master.__RenderMasterBody(HtmlTextWriter __w, Control parameterContainer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Control.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.Page.Render(HtmlTextWriter writer)    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</stackTrace></error>


    Thanks,
    Neha

     

     

     

  2. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 18 Jul 2012 Link to this post

    Hello Neha,

    I have inspected the issue once again and it seems that this is an ASP .NET limitation and there is nothing much more to be done about this issue . You can try to set the value to maxJsonLength="999999999" as it suggested in this blog post as an absolute max value for the JSON data returned from ASP .NET web service.

    Here is another forum thread that may be helpful. 

    Hope this will be helpful.

    Kind regards,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top