How To Set An Unlimited Length For MaxJsonLength In Web.Config

We may face this issue, when we use webservice for retrieving huge amount of data.
Especially when the output is JsonResult.
Lets start with a simple example.


In the given example, we are using Jquery ajax call for getting data from server.
Here we are trying to get the list of string of size 16000.
Normally, we would definitely get the the error.
There is a limit for transferring data using Webservices.
If that limit exceeds, we will get this error.
In order to Resolve this issue, we have to increase the limit to its maximum.

On the web.config file, we have to increase the maxJsonLength of jsonSerialization property.
The Maximum value is 2147483644 (Int32.MaxValue).
By this way, we can resolve this issue.