【发布时间】:2014-09-28 22:45:46
【问题描述】:
我收到了这个错误
System.InvalidOperationException:ManageUser Web 服务方法名称 无效。在 System.Web.Services.Protocols.HttpServerProtocol.Initialize() 在 System.Web.Services.Protocols.ServerProtocolFactory.Create(类型类型, HttpContext 上下文,HttpRequest 请求,HttpResponse 响应, 布尔值&中止处理)
当我尝试使用 ajaxcall 从按钮单击事件中调用 Web 服务方法时
$.ajax() {
type: "POST",
url: "RechargeService.asmx/ManageUser",
//data: "{objUser: " + JSON.stringify(objUsers) + "}",
data: "{Name:'" + Name + "',Address:'" + Address + "',City:'" + City + "',State:'" + State + "',Pincode:'" + Pincode + "',MobileNo:'" + MobileNo + "',Email:'" + Email + "',Password:'" + Password + "',Parameter:'" + Parameter + "',UserRole:'" + UserRole + "',UserStatus:'" + UserStatus + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
cache: false,
success: function (data) {
data = JSON.parse(data.d);
if (data.Sucess) {
$("#lblMsg").html('Registration done successfully');
$("#txtEmail").val('');
$("#txtPassword").val('');
$("#txtMobileNo").val('');
$("#txtConfirmPassword").val('');
$('#myModal1').hide();
alert("Your registration completed successfully");
} else {
alert("Already registered with this email id");
$("#txtEmail").val("");
}
},
error: function (xhr, status, error) {
alert(xhr.responseText + " \n " + status + " \n " + error);
alert("There was an error while processing. Please try again after some time.");
}
}
方法
[WebMethod]
Public string ManageUser()
{
}
此代码在托管后在本地运行良好,只有我得到上述错误请帮助我解决这个问题.. 提前致谢
【问题讨论】:
-
jquery ajax 括号无效。检查jquery ajax
-
在本地查看它的工作正常我的意思是开发环境括号很好我检查了......只有在托管后我才得到上述错误..我们需要对托管服务器进行任何更改
标签: c# jquery ajax web-services