Visual Web部件ajax http 500内部服务器错误问题 [英] Visual web part ajax http 500 internal server error issue

查看:76
本文介绍了Visual Web部件ajax http 500内部服务器错误问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello,
        I have created visual web part for fetching data from SharePoint list and display on it.
For fetching data from list I have used server object model. For fetching data from SharePoint list I have created "Application Page" and written code in it.  
     In application page I have mentioned the method as a "[WebMethod]".I am calling application page method by using Ajax (i.e. from Sample.ascx page).
On search button I have written code for calling Application Page method "GetFilterResults" by using Ajax.
Problem is that when I click on search button it is giving error 500 Internal Server error that is Ajax is not calling "GetFilterResults" method it jumps to the "error method of Ajax".
   One thing to mention is that, the code is working fine on Development, System Test and UAT environment only it is not working on "Production" environment.
  Below is the sample code in Visual Web Part page (i.e. in Sample.ascx page).





我尝试过:





What I have tried:

//Call Ajax function for getting filter condition results from Content Metadata Master List               

var parameters = { arrFilters: FilterArray, arrFilterCondition: FilterConditionArray };
$.ajax({
type: "POST",
async: false,
url: "/_layouts/15/BulkWorkflow/BulkWorkflowCode.aspx/GetFilterResults",
data: JSON.stringify(parameters),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
	
var data1 = jQuery.parseJSON(response.d)

for (var i in data1) {

 alert(data1[i].ContentID + ", " + data1[i].ContentName + " , " + data1[i].ContentTitle);	

}
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Error");
alert(xhr.status);
alert(thrownError);
}
});




And code in Application page (i.e. in BulkWorkflowCode.aspx page),







[WebMethod]
public static string GetFilterResults(string[] arrFilters, string[] arrFilterCondition)
{
	
	//Code for fetching data from SharePoint list and return output as a String
}







also I have checked the error logs in  Fiddler tool 





它给出了以下错误,



{消息:处理请求时出错。,StackTrace:,Exc eptionType:}



it is giving following error,

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}

推荐答案

.ajax({
type: POST
async false
url: / _ layouts / 15 / BulkWorkflow / BulkWorkflowCode.aspx / GetFilterResults
data:JSON.stringify(parameters),
contentType: application / json; charset = utf-8
dataType: json
成功:函数(响应){

var data1 = jQuery.parseJSON(response.d)

for var i in data1) {

alert(data1 [i] .ContentID + + data1 [i] .ContentName + + data1 [i] .ContentTitle);

}
},
错误:function(xhr,ajaxOptions,thrownError){
alert( 错误);
alert(xhr.status);
alert(thrownError);
}
});
.ajax({ type: "POST", async: false, url: "/_layouts/15/BulkWorkflow/BulkWorkflowCode.aspx/GetFilterResults", data: JSON.stringify(parameters), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var data1 = jQuery.parseJSON(response.d) for (var i in data1) { alert(data1[i].ContentID + ", " + data1[i].ContentName + " , " + data1[i].ContentTitle); } }, error: function (xhr, ajaxOptions, thrownError) { alert("Error"); alert(xhr.status); alert(thrownError); } });




And code in Application page (i.e. in BulkWorkflowCode.aspx page),







[WebMethod]
public static string GetFilterResults(string[] arrFilters, string[] arrFilterCondition)
{
	
	//Code for fetching data from SharePoint list and return output as a String
}







also I have checked the error logs in  Fiddler tool 





它发出以下错误,



{消息:处理请求时出错。,StackTrace:,ExceptionType:}



it is giving following error,

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}


这篇关于Visual Web部件ajax http 500内部服务器错误问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆