我正在为 ASP.NET MVC 使用 Kendo UI 图表,并向其提供数据传输对象列表以通过 Ajax 请求填充数据。然而,问题在于列表的大小。我在这个列表中有大约 3900 个 dto(因为它是从文件中解析出来的)并且每个 dto 中有 9 个对象:
public DateTime Time { get; set; }
public int BeatsPerMinute { get; set; }
public double Speed { get; set; }
public int Cadence { get; set; }
public double? Altitude { get; set; }
public int Power { get; set; }
public int? PowerBalance { get; set; }
public double Distance { get; set; }
我需要每个 dto 中的所有项目,但是当我发送 Ajax 请求时我的浏览器超时。我已将我的 web.config jsonSerialization maxJsonLength 设置为 50000000,但这没有用。
关于此的推荐方法是什么?
最佳答案
如果您使用 asp.net mvc 3.0,它会忽略 web.config 中的 maxJsonLength。在 Controller 中使用:
return new JsonResult { Data = Result, MaxJsonLength = Int32.MaxValue };
关于c# - ASP.NET MVC 应用程序在 Ajax 请求上使用 Kendo Chart 和大数据源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35919368/