我做阿贾克斯后,从在mvc4的JavaScript发布的数据,但它不能与下面的异常在与庞大的数据系统mvc4阿贾克斯后抛出System.ArgumentException异常
string exceeds the value set on the maxJsonLength property.
Parameter name: input
System.ArgumentException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
我已经尝试设置在网络配置配置,但它不工作
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647"/>
</webServices>
</scripting>
</system.web.extensions>
我也尝试下面的链接,但没有任何工程: http://forums.asp.net/t/1751116.aspx?How+to+increase+maxJsonLength+for+JSON+POST+in+MVC3
var editorText = eval(htmlEditor).GetHtml();
$.ajax({type: 'POST',
cache: false,
contentType: 'application/json; charset=utf-8',
url: "../Home/SaveExceptionLetter",
data: JSON.stringify({ message: editorText }),
datatype: 'json',
success: function() {
});
} });
[HttpPost]
[ValidateInput(false)]
public void SaveExceptionLetter(string message){
//processing this message
}
string exceeds the value set on the maxJsonLength property.
Parameter name: input
System.ArgumentException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Parameter name: input
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
at System.Web.Mvc.JsonValueProviderFactory.GetDeserializedObject(ControllerContext controllerContext)
at System.Web.Mvc.JsonValueProviderFactory.GetValueProvider(ControllerContext controllerContext)
at System.Web.Mvc.ValueProviderFactoryCollection.<>c__DisplayClassc.<GetValueProvider>b__7(ValueProviderFactory factory)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider(ControllerContext controllerContext)
at System.Web.Mvc.ControllerBase.get_ValueProvider()
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState)
web配置设置为 WEBSERVICES> –
usFarswan
2014-11-06 07:23:20
看看 http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-max-sonlength-in-web-config?rq=1 – 2014-11-06 07:39:39