title: setting jsonSerialization maxJsonLength in ASP.net Web.Config gives 500 error
body: <p>So, I keep getting the 500 - Internal server error page on my .net site when I set the <code>maxJsonLength</code> in my <code>web.config</code>.</p>
  <p>I'm modifying the <code>.config</code> because even though I use <code>MaxJsonLength = Int32.MaxValue</code> on my vb.net <code>JavaScriptSerializer</code>, I'm still getting <code>InvalidOperationException</code> for a large dictionary I'm trying to transmit even though it's well below the <code>4GB</code> the <code>MaxJsonLength @ Int32.MaxValue</code> allows or even the supposed <code>4mb</code> default limit.</p>
  <p>I'm using <code>toolkitscriptmanager</code> if that means anything.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;system.web.extensions&gt;
      &lt;scripting&gt;
          &lt;webServices&gt;
              &lt;jsonSerialization maxJsonLength=&quot;2147483647&quot; /&gt;
          &lt;/webServices&gt;
      &lt;/scripting&gt;
  &lt;/system.web.extensions&gt;
  </code></pre>
  <p>this didn't help (actually, it also gives 500 error without above code)</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;sectionGroup name=&quot;system.web.extensions&quot; type=&quot;System.Web.Extensions&quot;&gt;
      &lt;sectionGroup name=&quot;scripting&quot; type=&quot;System.Web.Extensions&quot;&gt;
          &lt;sectionGroup name=&quot;webServices&quot; type=&quot;System.Web.Extensions&quot;&gt;
              &lt;section name=&quot;jsonSerialization&quot; type=&quot;System.Web.Extensions&quot; /&gt;
          &lt;/sectionGroup&gt;
      &lt;/sectionGroup&gt;
  &lt;/sectionGroup&gt;
  </code></pre>
  <p>heard this should help with <code>InvalidOperationException</code>, but it didn't.  I took it out, and still 500 error.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;add key=&quot;aspnet:MaxJsonDeserializerMembers&quot; value=&quot;2147483647&quot; /&gt;
  </code></pre>
  <p>Many thanks in advance!</p>
  <p><strong>Edit</strong></p>
  <p>Same problem, but his solution doesn't work for me.  The last code he added also gives 500 error.  <a href="https://stackoverflow.com/questions/3209192/problem-with-system-web-extensions-config-group-when-upgrading-to-net-4-0">Problem with &lt;system.web.extensions&gt; config group when upgrading to .NET 4.0</a></p>