[英]Not working on azure server but works fine in local environment?
I have jQuery Ajax method to call a web method in C# code. 我有jQuery Ajax方法来调用C#代码中的Web方法。 The code works fine in local environment but it does not work in server.
代码在本地环境中工作正常,但在服务器中不起作用。 But some web method and jQuery Ajax calls work fine with normal SQL statement, but with a stored procedure in web method which returns some data it does not work.
但是一些web方法和jQuery Ajax调用在普通的SQL语句中运行良好,但是在web方法中存储过程会返回一些不起作用的数据。 It shows an error message as
它显示错误消息
{Message: "There was an error processing the request.",StackTrace:"", ExceptionType: ""}
{消息:“处理请求时出错。”,StackTrace:“”,ExceptionType:“”}
ExceptionType:""ExceptionType: “”
Message:"There was an error processing the request."消息:“处理请求时出错。”
StackTrace:""堆栈跟踪:””
Here's my Ajax call... 这是我的Ajax调用......
$.ajax({
url: "AutoRFQ_Vendors_SP.aspx/BindGrid"
, type: "POST"
, data: JSON.stringify(objdrpdata)
, contentType: "application/json;"
, success: function (data) {
$body.removeClass("loading");
var vendorsource = {
datatype: "json"
, localdata: data.d
, datafields: [
{
name: 'CommonMakerNameDisplay'
}
, {
name: 'EqpExtendType'
}
, {
name: 'CommonMakerName'
}
, {
name: 'IsForAutoRFQ'
}
, {
name: 'VendorName'
}
, {
name: 'CurrencyCode'
}
, {
name: 'Proc_Vendors_AllowedCurrencyID'
}
, {
name: 'SortCode'
}
, {
name: 'xSortCode'
}
, {
name: 'IsTitle'
}
, {
name: 'NoOfRFQs'
}
, {
name: 'NoOfOrders'
}
, {
name: 'TotalPOAmtInUSD'
}
}
});
Here's my web method: 这是我的网络方法:
[WebMethod(EnableSession = true)]
public static string BindGrid(string vslFilter, string yearFilter, string eqpmtFilter)
{
DataTable dt = null;
string gridvendorlist = "";
try
{
if (HttpContext.Current.Session["P_Hub_AutoRFQVendorDataTable"] == null || (string) HttpContext.Current.Session["P_Hub_AutoRFQVslFilter"] != vslFilter || (string) HttpContext.Current.Session["P_Hub_AutoRFQYearFilter"] != yearFilter || (string) HttpContext.Current.Session["P_Hub_AutoRFQEqpmtFilter"] != eqpmtFilter)
{
string vslFilterType = "", vslFilterValue = "";
if (vslFilter.Length == 3)
vslFilter = "VSL-" + vslFilter;
string[] vslType = vslFilter.Trim().Split('-');
if (vslType[0].ToString().Trim().ToUpper() == "VSL")
{
vslFilterType = "VSL";
vslFilterValue = vslType[1].ToString();
}
else if (vslFilter != "-1")
{
vslFilterType = "Group";
vslFilterValue = vslFilter.ToString();
}
string spName = "W_Enh_CommonMakers_RFQVendors";
string[] paramField = { "@CompanyCode", "@VslFilterType",
"@VslFilterValue", "@NoOfYrToShow",
"@EQ_EquipmentID" };
object[] paramValue = { GenFuncs.COMPANYCODE,
vslFilterType,
vslFilterValue,
yearFilter,
eqpmtFilter };
dt = DBFuncs.dbExecuteSP(spName, paramField, paramValue);
HttpContext.Current.Session["P_Hub_AutoRFQVendorDataTable"] = dt;
HttpContext.Current.Session["P_Hub_AutoRFQVendorSelectedRowIndex"] = null;
HttpContext.Current.Session["P_Hub_AutoRFQ_ScrollIndex"] = null;
HttpContext.Current.Session["P_Hub_AutoRFQVslFilter"] = vslFilter;
HttpContext.Current.Session["P_Hub_AutoRFQYearFilter"] = yearFilter;
HttpContext.Current.Session["P_Hub_AutoRFQEqpmtFilter"] = eqpmtFilter;
gridvendorlist = Func_Ajax.GetJson(dt);
}
else
{
dt = (DataTable)HttpContext.Current.Session["P_Hub_AutoRFQVendorDataTable"];
gridvendorlist = Func_Ajax.GetJson(dt);
}
}
catch (Exception err)
{
GenFuncs.AddToErrLog("-1", "xxx", "Error", err.Message, Path.GetFileName(HttpContext.Current.Request.PhysicalPath), "BindGrid");
}
finally
{
dt = null;
}
return gridvendorlist;
}
Is there any extra thing I need to do in server? 我需要在服务器上做什么额外的事情吗?
After 5 hrs of explore i finally found some silly mistake which was in my web.config file 经过5个小时的探索,我终于发现了一些在我的web.config文件中的愚蠢错误
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647"/>
</webServices>
</scripting>
</system.web.extensions>
works fine....Thank you 工作正常....谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.