问题:

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

<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1024000000" />
</webServices>
</scripting>
</system.web.extensions>
这个方法测试了没有效果。

stackoverflow上找到答案

public ContentResult GetOrderList()
{
try
{
IList<OrderAll> list = new List<OrderAll>();

return new ContentResult { Content = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }.Serialize(UnifyResponse.ReturnFun(list)), ContentType = "application/json"

                };

                //return this.Json(UnifyResponse.ReturnFun(list));
}
catch (Exception ex)
{
return new ContentResult
{ Content = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }.Serialize(UnifyResponse.ThrowError(ex)),
ContentType = "application/json"
};
//return this.Json(UnifyResponse.ThrowError(ex));
}
}

ASP.NET MVC Json()处理大数据异常解决方法,字符串的长度超过了为 maxJsonLength的更多相关文章

  1. [转]ASP.NET MVC Json()处理大数据异常解决方法 json maxjsonlength

    本文转自:http://blog.csdn.net/blacksource/article/details/18797055 先对项目做个简单介绍: 整个项目采用微软的ASP.NET MVC3进行开发 ...

  2. ASP.NET MVC Json() 处理大数据异常解决方法 json MaxJsonLength

    网上很多解决方案,在webconfig中添加,但是实践证明无效 <system.web.extensions> <scripting> <webServices> ...

  3. .NET MVC Json()处理大数据异常解决方法

    [1-部分原文]: .NET MVC Json()处理大数据异常解决方法 整个项目采用微软的ASP.NET MVC3进行开发,前端显示采用EasyUI框架,图表的显示用的是Highcharts,主要进 ...

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

    在.net mvc的controller中,方法返回JsonResult,一般我们这么写: [HttpPost] public JsonResult QueryFeature(string url, ...

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

    "/"应用程序中的服务器错误.使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错.字符串的长度超过了为 maxJsonLength 属性设置的值. ...

  6. JSON JavaScriptSerializer 字符串的长度超过了为 maxJsonLength 属性设置的值。

    1.序列化: 以下代码在对象过大时会报错:进行序列化或反序列化时出错.字符串的长度超过了为 maxJsonLength 属性设置的值. //jsonObj比较大的时候会报错 var serialize ...

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

    在.net mvc的controller中,方法返回JsonResult,一般我们这么写:   [HttpPost]   public JsonResult QueryFeature(string u ...

  8. ASP.NET MVC命名空间时引起错误的解决方法

    使用VS2012新建了一个Asp.net mvc5的项目,并把项目的命名空间名称更改了(Src更改为UXXXXX),然后就导致了以下错误 刚开始以后是项目的属性中的命名空间没有更改过来的问题,但我在重 ...

  9. poi大数据导入解决方法

    This one comes up quite a lot, but often the reason isn't what you might initially think. So, the fi ...

随机推荐

  1. AMD正式公布第七代桌面级APU AM4新接口

    导读 本月5日,AMD正式公布了入门级的第七代桌面级APU为Bristol Ridge,在性能和能效方面较上一代产品拥有显著提升.AMD同时确认Zen处理器和新APU(Bristol Ridge)都将 ...

  2. r-cnn学习(一)

    http://closure11.com/rcnn-fast-rcnn-faster-rcnn%E7%9A%84%E4%B8%80%E4%BA%9B%E4%BA%8B/ 首先看fast r-cnn这篇 ...

  3. 编写Delphi控件属性Stored和Default的理解及应用

    property ButtonSize: Integer read FButtonSize write SetButtonSize default 0;    property Color: TCol ...

  4. django formset bug?

    碰到了一个郁闷的问题,修改inlineformset时,全部删掉子表,再新增一行时,报错. 背景: 用django配合jq做动态表格,实现用js动态添加/删除行,并通过inlineformset更新到 ...

  5. discuz内置常用CSS代码分析

    CSS多IE下兼容HACK写法 所有 IE浏览器适用:.ie_all .foo { ... } IE6 专用:.ie6 .foo { ... } IE7 专用:.ie7 .foo { ... } IE ...

  6. Redis Sentinel机制与用法(一)

    Sentinel spring 集群配置: 概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕 ...

  7. Intel项目所用jquery小知识点总结

    1.$("#tdGeo input[type='checkbox']:checked")   ---筛选出所有已经Check的Checkbox 2.$("#tdCount ...

  8. Delete a node from BST

    Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...

  9. H-Index I & II

    H-Index I Given an array of citations (each citation is a non-negative integer) of a researcher, wri ...

  10. POJ 3728

    http://poj.org/problem?id=3278 题目大意就是在同一坐标轴上给你一个人的坐标,一个牛的坐标,而人的运动每一次运动有三种方式,一种是后退1,一种是前进1,还有一种是坐标翻倍, ...