部署后,jquery ajax成功函数响应为空。?
我在我的项目中使用jqueryajax函数,使用静态方法连接到wcf服务。在本地主机中,我从静态方法中得到结果。部署到iis后,预期结果未出现部署后,jquery ajax成功函数响应为空。?,jquery,asp.net,json,ajax,wcf,Jquery,Asp.net,Json,Ajax,Wcf,我在我的项目中使用jqueryajax函数,使用静态方法连接到wcf服务。在本地主机中,我从静态方法中得到结果。部署到iis后,预期结果未出现 **ClientSide Code:** $.ajax({ url: 'SearchResults.aspx/GetSearhResult', type: 'POST', data: JSON.stringify({ SearchKey: searchKey, ActionName: action }), content
**ClientSide Code:**
$.ajax({
url: 'SearchResults.aspx/GetSearhResult',
type: 'POST',
data: JSON.stringify({ SearchKey: searchKey, ActionName: action }),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (response) {
//while debugging in browser this response is showing empty
if (response.d != "")
{
var obj = JSON.parse(response);
**here i am binding result to html table**
}
},
error: function (a,b,c) {
}
});
**ServerSide Code:**
[WebMethod]
public static string GetSearhResult(string SearchKey,string ActionName)
{
**Here i am connecting to wcf service In that service executing one stored procedure i am converting result into json string**
retun Newtonsoft.Json.JsonConvert.SerializeObject(object);
}
**Note:** i connected deployed wcf service in local_host using endpoints at that time i am getting result.
当你说它不会出现时,你的意思是不会出现结果(比如40X)或者结果没有出现(空obj)?我不确定您在进行开发时是否连接到prod。有些公司没有在wcf setup for dev中设置身份验证。您是否在prod中进行了身份验证?它没有显示任何错误,结果返回为空obj。仅供参考,我在不同地区使用相同的服务,当时我得到了结果。