网上很多解决方案,在webconfig中添加,但是实践证明无效
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1024000000" />
</webServices>
</scripting>
</system.web.extensions>
其他办法:当ajax请求返回json数据时,
return Json(new {}); return new JsonResult
{
Data = data,
MaxJsonLength = int.MaxValue, /*此处将MaxJsonLength设置为Int最大值,可解决此问题*/
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
};