您的位置:首页 > Web前端 > JavaScript

exceeding maxJsonLength property问题-mvc4

2014-11-14 02:40 465 查看
问题:the length of the string exceeds the value set on themaxJsonLength property解决方案:step1: 在web.config里添加
[code]
<configuration>[/code]
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
step2: 在controller里添加
[code]protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
[/code]
{
[code] r
eturn new JsonResult()[/code]{
Data = data,
ContentType=contentType,
ContentEncoding = contentEncoding,
JsonRequestBehavior = behavior,
MaxJsonLength = Int32.MaxValue
};
}
问题解决方案来源: http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config/12278956#12278956
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: