This is a migrated thread and some comments may be shown as answers.

Spell check hander error: The length of the string exceeds the value set on the maxJsonLength property

10 Answers 420 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Suhua
Top achievements
Rank 1
Suhua asked on 26 Dec 2014, 05:45 AM
I use client js method "startSpellCheck(); " to check spelling, it works fine when the text is small, but when the text content is large, for example 30k+ lines, an error page pop up:

 
Spell Check handler server error: 500<br><br><title>...The length of the string exceeds the value set on the maxJsonLength property.</title><br>...


I have set the maxJsonLength to a big value in web.config, but it seems that the spell check ignore the setting.
...

<system.web.extensions><br>    <scripting><br>      <webServices>       <br>        <jsonSerialization maxJsonLength="2147483644"></jsonSerialization><br>      </webServices><br>    </scripting><br>  </system.web.extensions>

10 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 26 Dec 2014, 02:49 PM
Hi Suhua,

Please take a look at the following forum thread and help article, where you will find detailed information on the error that you are receiving and how to handle it:

Hope this helps.



Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Suhua
Top achievements
Rank 1
answered on 29 Dec 2014, 07:53 AM
Hi Konstantin,

Thanks for your response,  I have set maxRequestLength and maxAllowedContentLength to a bigger value in the web.config, but still show the same error message:
Error during serialization or deserialization using the JSON JavascriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

I also checked the string length which is sent for spelling check: 285478


0
Suhua
Top achievements
Rank 1
answered on 30 Dec 2014, 02:54 AM
Hi, 

To reproduce the issue, you can use below codes:

function spellCheck() {
 
        //get spell check control
 
        var spellCheckID = $telerik.$("[id$='spellCheckRegisterTable']").attr("id");
 
        var spellCheckRegisterTable =
$find(spellCheckID);
 
        if (spellCheckRegisterTable) {
 
            spellCheckRegisterTable.set_textSource(new checkTextSource());
 
            
spellCheckRegisterTable.startSpellCheck();           
 
        }
 
    }
 
  
 
    function checkTextSource() {
 
        this.get_text = function () {
 
            
 
                //for test
 
                results =
"";
 
                for (var i = 0; i
< 40000; i++) {
 
                    results += "testt<br>";
 
                }
 
                
console.log(results.length);
 
                //end test
 
                 return results;          
 
 
  
 
        }
 
        this.set_text = function (newText) {          
 
        }
 
    }

 <jsonSerialization maxJsonLength="2147483644"></jsonSerialization>
 <httpRuntime useFullyQualifiedRedirectUrl="false" requestLengthDiskThreshold="8192" maxQueryStringLength="2097151" requestValidationMode="2.0" targetFramework="4.5" maxRequestLength="1048576" executionTimeout="20000" />
<requestLimits maxAllowedContentLength="1073741824" />

Could help me on this? I need to fix this as soon as possible. thanks 

Regards,

Suhua
0
Konstantin Dikov
Telerik team
answered on 05 Jan 2015, 08:01 AM
Hi Suhua,

Thank you for the sample.

I have tested the code snippet that you have provided and I was able to replicate the same issue. It seems that this is a limitation of the JavaScriptSerializer:
Nevertheless, I have located the code where a new instance of the JavaScriptSerializer is used and I log this as a feature request, so our developers team could investigate the possibility of setting the MaxJsonLength property to int.MaxValue for example or to the value set in the web.config. 

Please excuse us for any inconvenience caused by this.


Kind Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Duncan
Top achievements
Rank 1
answered on 01 Dec 2015, 10:17 AM
I am having the same issue. Is there anyway to resolve this ? 
0
Marin Bratanov
Telerik team
answered on 01 Dec 2015, 10:56 AM

Hello Duncan,

This has not been implemented yet. I created the following page where you can track the progress of this item: http://feedback.telerik.com/Project/108/Feedback/Details/176735-radspell-should-use-the-maxjsonlength-value-specified-in-the-web-config.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Latheesh
Top achievements
Rank 1
answered on 28 Apr 2020, 02:49 PM

Hi Marin,

Feedback portal says it has been completed, but has this been implemented (also for ASP.NET AJAX RadGrid) as well ?

I am getting the same error with Virtualization enabled.

Regards

Latheesh

0
Rumen
Telerik team
answered on 29 Apr 2020, 07:49 AM

Hi,

The reason for the serialization error in your Grid project is most likely due to that too much data is serialized at once.

I suggest you try lowering the InitiallyCachedItemsCount on your end (set lower number - 1000 for example) which should help you overcome the maxJsonLength error:

<Virtualization EnableVirtualization="true" InitiallyCachedItemsCount="1000" LoadingPanelID="ajaxLoadingPanel" ItemsPerView="100" />

Please let me know in case you need additional assistance and please provide a simple repro project where we can see the error.

 

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Latheesh
Top achievements
Rank 1
answered on 29 Apr 2020, 08:07 AM

Hi Rumen,

Thank you for the reply.
I had tested with InitiallyCachedItemsCount="1000" setting already. It does not satisfy my requirement since I need to cache 100k records(or at least 10k) initially in the grid.
This is to avoid binding the 100k data again in the grid (with pagesize 1000) while navigating through pages. Every server call has to process the 100k records again(It's not a simple select) if I make a server data request which takes up 10s. So every page switch takes 10s or more.

Please provide a specific workaround to achieve this requirement to cache the whole data initially itself.

Regards
Latheesh

0
Rumen
Telerik team
answered on 29 Apr 2020, 01:17 PM

Hi Latheesh,

Thank you for the details!

In this case, you can cache the first 100k items on the server as shown in this demo https://demos.telerik.com/aspnet-ajax/treelist/examples/databinding/loadondemand/defaultcs.aspx, e.g.

 

        public DataTable TreeListSource
        {
            get
            {
                if (Session["TreeListSource"] == null)
                {
                    Session["TreeListSource"] = GetDataTable("SELECT TOP(10000) * FROM TestItems");
                }
 
                return Session["TreeListSource"] as DataTable;
            }
        }

 

and configure RadGrid as usual with a normal amount of initially cached items.

 

Best Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Spell
Asked by
Suhua
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Suhua
Top achievements
Rank 1
Duncan
Top achievements
Rank 1
Marin Bratanov
Telerik team
Latheesh
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or