【发布时间】:2011-01-26 01:26:32
【问题描述】:
我正在尝试从 .aspx 页面通过 javascript 调用 webservice 方法,我收到此错误,我确实在 c# 方法的顶部有 [WebMethod]。
未知的 Web 方法 [object Object]。
参数名称:methodName
<h2> <i>Unknown web method [object Object].<br>Parameter name: methodName</i> </h2></span>
说明:在执行当前 Web 请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
<br><br>
<b> Exception Details: </b>System.ArgumentException: Unknown web method [object Object].<br>Parameter name: methodName<br><br>
[ArgumentException]: Unknown web method [object Object].
Parameter name: methodName
at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)
at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)
at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)
at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
【问题讨论】:
-
感谢您显示收到的异常,但您需要显示代码。猜测一下,你的方法是
static吗? -
然后创建一个有同样问题的示例服务。
标签: c# javascript asmx