I am using the autocomplete feature of jQuery. When I try to retrieve the list of more then 17000 records (each won't have more than 10 char length), it's exceeding the length and throws the error:
Exception information:
Exception type: InvalidOperationException
Exception message: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Can I set an unlimited length for maxJsonLength
in web.config
? If not, what is the maximum length I can set?
You do not need to do with web.config You can use short property during catch value of the passing list For example declare a model like
here i use short proporties like BC =barcode BE=book edition and so on
I was having this problem in ASP.NET Web Forms. It was completely ignoring the web.config file settings so I did this:
Of course overall this is terrible practice. If you are sending this much data in a web service call you should look at a different approach.
I suggest setting it to Int32.MaxValue.
if this maxJsonLength value is a int then how big is its int 32bit/64bit/16bit.... i just want to be sure whats the maximum value i can set as my maxJsonLength
For those who are having issues with in MVC3 with JSON that's automatically being deserialized for a model binder and is too large, here is a solution.
Thanks to http://blog.naver.com/techshare/100145191355 and https://gist.github.com/DalSoft/1588818 for pointing me in the right direction for how to do this. The last link on the first site contains full source code for the solution.
use
lib\Newtonsoft.Json.dll