未知的网络方法 Delete_Local_ABC。参数名称:ASP.NET app 中的 methodName
Unknown web method Delete_Local_ABC. Parameter name: methodName in ASP.NET app
我在下面的代码中遇到了这个错误,它基本上启动了 POST
请求
ABC.ascx
var ABCid = $(aTag).data('id');
$.ajax({
type: "POST",
url: "WebMethods.aspx/Delete_Local_ABC",
data: "{'id':'" + ABCid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successdelete_ABC,
error: Errordelete_ABC
});
}
WebMethods.aspx.cs
[WebMethod]
public static int Delete_Local_ABC(string id)
{
ABC objABC = new ABC();
objABC.ABC_ID = Convert.ToInt32(id);
// call business manager
try
{
BusinessManager businessManager = new BusinessManager();
businessManager.ManageABC(objABC, OperationTypes.Validate);
return 1;
}
catch (Exception ex)
{
throw ex;
}
}
我正在 BusinessManager.cs
中调用以下方法
....
case OperationTypes.Validate:
obj.deleteLocalABC();
break;
...
和ABC.cs
public bool deleteLocalABC()
{
string query = "DELETE FROM TBL_ABC WHERE ABC_ID ='" + this.ABC_ID + "'";
_dbManager.executeQuery(query);
return true;
}
我已经尝试了所有可用的在线解决方案,但没有任何效果。此代码与 Visual Studio
完美配合,但不适用于主要部署。
使用
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
而不仅仅是 [WebMethod]
。
我希望你的方法在添加之后能正常工作。
我在下面的代码中遇到了这个错误,它基本上启动了 POST
请求
ABC.ascx
var ABCid = $(aTag).data('id');
$.ajax({
type: "POST",
url: "WebMethods.aspx/Delete_Local_ABC",
data: "{'id':'" + ABCid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successdelete_ABC,
error: Errordelete_ABC
});
}
WebMethods.aspx.cs
[WebMethod]
public static int Delete_Local_ABC(string id)
{
ABC objABC = new ABC();
objABC.ABC_ID = Convert.ToInt32(id);
// call business manager
try
{
BusinessManager businessManager = new BusinessManager();
businessManager.ManageABC(objABC, OperationTypes.Validate);
return 1;
}
catch (Exception ex)
{
throw ex;
}
}
我正在 BusinessManager.cs
....
case OperationTypes.Validate:
obj.deleteLocalABC();
break;
...
和ABC.cs
public bool deleteLocalABC()
{
string query = "DELETE FROM TBL_ABC WHERE ABC_ID ='" + this.ABC_ID + "'";
_dbManager.executeQuery(query);
return true;
}
我已经尝试了所有可用的在线解决方案,但没有任何效果。此代码与 Visual Studio
完美配合,但不适用于主要部署。
使用
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
而不仅仅是 [WebMethod]
。
我希望你的方法在添加之后能正常工作。