exceeding maxJsonLength property问题-mvc4

问题:the length of the string exceeds the value set on the
maxJsonLength property
解决方案:
step1: 在web.config里添加

  
   
       
           
               
           
       
   
 


step2: 在controller里添加
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)

{  
  return new JsonResult()
    {  
                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


你可能感兴趣的:(exceeding maxJsonLength property问题-mvc4)