我的问题是,当我在数据中传递大值的字符串时,它不会调用服务并且出错。当字符串值很小时它工作正常 如果我传递文件的价值很大,那么就会产生问题。 代码:
var requestData = {
"PostData": [{ "Key": "subject", "Value": "e1 note"},{ "Key": "documentbody", "Value": "", "Datatype": "String" }],
};
$.ajax({
type: "POST",
url: "http://localhost:32911/Service1.svc/savedata",
data: JSON.stringify(requestData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data, status, XMLHttpRequest) {
debugger;
},
error: function (xhr) {
alert("error"+xhr.responseText);
}
});
我在c#中的课程:
public class RequestData
{
[DataMember]
public List<PostData> PostData { get; set; }
}
public class PostData
{
[DataMember]
public string Key { get; set; }
[DataMember]
public string Value { get; set; }
}
控制台出错:
&#34; NetworkError:413请求实体太大 - http://localhost:33919/Service1.svc/savedata&#34;