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
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:
- Maximum request length exceeded
- PRB: Cannot Upload Large Files When You Use the HtmlInputFile Server Control
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.
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
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
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:
- "The value of the MaxJsonLength property applies only to the internal JavaScriptSerializer instance that is used by the asynchronous communication layer to invoke Web services methods. (MSDN: ScriptingJsonSerializationSection.MaxJsonLength Property)"
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.
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,
Telerik
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
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
Our thoughts here at Progress are with those affected by the outbreak.
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
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
Our thoughts here at Progress are with those affected by the outbreak.