我在Jquery ajax调用中面临一个问题。我正在研究asp.net应用程序。我正在返回一个字符串数组的JSON字符串。在我的本地系统中它工作正常,但在部署之后抛出此错误"无法加载资源:服务器响应状态为500(内部服务器错误)"。
function RenderUserPerosnaDashboard() {
$.ajax({
type: "POST",
url: "UserPersonaDashBoard.aspx/RenderUserPerosnaDashboard",
contentType: "application/json",
cache: false,
dataType: "json",
success: function (data) {
//Brute Force Attack User Prospective Chart Rendering Method
var BFDeviceChartObj = JSON.parse(data.d[0]);
setSuspiciusUserBruteForceChart(BFDeviceChartObj);
//Brute Force Attack Device Prospective Chart Rendering Code
var BFUserChartObj = JSON.parse(data.d[1]);
setDeviceUseBruteForceChart(BFUserChartObj);
setSuspiciusUserAccessBehaviorAnamolyChart();
setSuspiciusDeviceAccessBehaviorAnamolyChart();
setSuspiciusAccountCreatedChart();
setAccountCreatedMonthChart();
InitializeModalPopUp();
},
error: function (data) {
}
});
服务器端代码
[WebMethod]
public static string[] RenderUserPerosnaDashboard()
{
string[] jsonArray = new string[2];
jsonArray[0] = DashboardHelper.GetSuspiciousUserAccountsBruteForce();
jsonArray[1] = DashboardHelper.GetSuspiciousDeviceBruteForce();
return jsonArray;
}
我在本地系统中遇到同样问题的另一个信息,但在Web配置文件中添加以下配置后,它已得到解决。
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000" />
</webServices>
</scripting>
请帮帮我。