The length of the string exceeds the value set on the maxJsonLength property

       今天无意中发现当选择某个国家&城市联动时,遇到Ajax返回数据之后无法填充City的问题,查看HttpWatch,
原来是:The length of the string exceeds the value set on the maxJsonLength property, 也就是返回
的Json数据的长度超过了默认的102400!
 因为DB的数据都是从原C/S系统导过来,冗余数据太多[CityName一样,CityCode不一样]导致某国家下面的城市
数高达2000+,所以返回的时候才出现上面问题.
只需在Web.config中修改maxJsonLength即可
<system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="250000">
        </jsonSerialization>
      </webServices>
    </scripting>
  </system.web.extensions> 

原文地址:https://www.cnblogs.com/maoniu602/p/1583435.html