patterncsharpCritical
Can I set an unlimited length for maxJsonLength in web.config?
Viewed 0 times
weblengthsetformaxjsonlengthcanunlimitedconfig
Problem
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
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?Solution
Note: This answer applies only to Web services. If you are returning JSON from a Controller method, make sure you read this Stack Overflow answer below as well: Can I set an unlimited length for maxJsonLength in web.config?
The MaxJsonLength property cannot be unlimited. It is an integer property that defaults to 102400 (100k).
You can set the
The MaxJsonLength property cannot be unlimited. It is an integer property that defaults to 102400 (100k).
You can set the
MaxJsonLength property on your web.config file:
Context
Stack Overflow Q#1151987, score: 806
Revisions (0)
No revisions yet.