我必须使用基于 Angular 的应用程序来处理 MVC,我必须从数据库中检索 2000 万条数据以使用 Angular 发送。
如果我从 json 发送低于 13000 个数据返回,则返回错误。 否则会出现此错误。
所以使用了下面的解决方案,它工作正常,但是为什么必须使用这个,JSON结果的大小限制是多少。
var jsonResult = Json(x, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
JsonResult 的数据大小的最大大小是多少?
最佳答案
如果你用另一种方式编写它,你的错误就会消失:
return new JsonResult()
{
Data = x,
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
MaxJsonLength = Int32.MaxValue
};
关于asp.net-mvc - mvc Controller 中 JsonResult 的最大大小是多少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42116613/