You have to adjust the maxJsonLength property to a higher value in web.config
to resolve the issue.
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644"/>
</webServices>
</scripting>
</system.web.extensions>
Set a higher value for aspnet:MaxJsonDeserializerMembers
in the appSettings:
<appSettings>
<add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>
If those options are not working you could try creating a custom json value provider factory using JSON.NET as specified in this thread.
Using a global setting will activate large json responses throughout your entire application which might open you up to a denial of service attack.
If a few choice locations are allowed this, you can very quickly use another json serialiser using the Content method like so:
using Newtonsoft.Json;
// ...
public ActionResult BigOldJsonResponse()
{
var response = ServiceWhichProducesLargeObject();
return Content(JsonConvert.SerializeObject(response));
}
// ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With