Today one of the internal web applications that we have wouldn't run properly on my development machine (it works fine on the production server). When opened it would produce the following exception:
It seems that the production server has a higher
maxJsonLengthvalue in its machine.config than my development machine. To solve this problem, add the following in your
<jsonSerialization maxJsonLength="2000000000" />
If you get the following exception after adding the above:
Unrecognized configuration section system.web.extensions.
<ConfigSections>part of your
<sectionGroup name="system.web.extensions" type="System.Web.Extensions">
<sectionGroup name="scripting" type="System.Web.Extensions">
<sectionGroup name="webServices" type="System.Web.Extensions">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
From the above, just add the parts that are missing in your
web.config. As you can see, I have used the .Net 3.5 version here, you might need another version of this assembly, I have not tested this (yet).