使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength 属性设置的值。

1.项目是mvc 

webconfig 各种配置无果

 <httpRuntime useFullyQualifiedRedirectUrl="true" executionTimeout="120" maxRequestLength="1024000000"/> 

<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1024000000" />
</webServices>
</scripting>
</system.web.extensions>

---------------------------

以上都不起作用,以上好像可以支持webform

mvc的解决如下:

  return new JsonResult()
  {
    Data = data,
    MaxJsonLength = int.MaxValue,
    ContentType = "application/json"
  };

原文地址:https://www.cnblogs.com/condon/p/11195879.html