您好,我正在开发 MVC4 应用程序。我正在将值保存到数据库中。我遇到了以下错误。
The request filtering module is configured to deny a request where the query string is too long.
我正在进行 ajax 调用并以 Json 格式发送数据,如下所示。
$.ajax({
type: "POST",
cache: false,
url: '/UploadDocument/SubmitDoc?JsonValue=' + JSON.stringify(SaveUpload) + '&gridData=' + strOrderArr,
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
'VerificationToken': forgeryId
},
success: function (response) {}
});
Web.config
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
我可以知道在将大量数据发布到数据库时,我是否遵循了处理上述情况的好方法?提前致谢。
请您参考如下方法:
这是一个 POST 请求,但您在查询字符串中传递数据!
在Data参数中传递数据:
$.ajax({
type: "POST",
cache: false,
url: '/UploadDocument/SubmitDoc',
data: JSON.stringify({ JsonValue: SaveUpload, gridData:strOrderArr }),
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
'VerificationToken': forgeryId
},
success: function (response) {}
});
