我正在做ajax帖子来发布mvc4中来自javascript的数据,但它失败并出现以下异常
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.
Run Code Online (Sandbox Code Playgroud)
我已经尝试在Web配置中设置配置但它无法正常工作
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647"/>
</webServices>
</scripting>
</system.web.extensions>
Run Code Online (Sandbox Code Playgroud)
我也试过下面的链接,但没有任何作用: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 …Run Code Online (Sandbox Code Playgroud)