我使用jQuery从SQL服务器检索数据。代码在我的个人计算机上工作正常(ASP.NET Framework 4.5 + SQL Server 2008 R2),但当我尝试在商业服务器(ASP.NET Framework 4.0.30319 + SQL server 2008 R2)上部署它时,它仍然弹出"未知的网络方法" 500内部服务器错误。请帮助。
方法是这样的:
public class rt300default : System.Web.Services.WebService
{
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public static string getDescription ()
{
return "XXX";
}
}
电话是这样的:
$(document).ready(function() {
$.ajax({
type: "POST",
url: "rt300default.aspx/getDescription",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
error: function (XMLHttpRequest, textStatus, errorThrown)
{
alert("Request: " + XMLHttpRequest.responseText.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown);
}
})
});
请帮助解决以下错误消息:
堆栈追踪:
[ArgumentException: Unknown web method getDescription.Parameter name: methodName]
System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs) +727543
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
异常详细信息:
System.ArgumentException: Unknown web method getDescription. Parameter name: methodName
有什么想法?感谢