ich Ajax Post tue die Daten von Javascript in mvc4 zu schreiben, aber es scheitert mit Ausnahme folgendenWährend Ajax-Post in mvc4 mit großen Datenmengen das System wirft System.ArgumentException Ausnahme
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.
Ich habe bereits versucht, die Einstellung Konfigurationen in Web-Config, aber es funktioniert nicht
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647"/>
</webServices>
</scripting>
</system.web.extensions>
ich auch unter Link versucht, aber nichts funktioniert: 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)
Die Web-Config-Einstellung, die ich angelegt habe, war webServices> –
usFarswan
werfen Sie einen Blick auf http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config?rq=1 –