I am trying to call a webservice method from .aspx page thro' javascript & i get this error, i do have [WebMethod] on the top of the c# method. Unknown web method [object Object].
Parameter name: methodName <h2> <i>Unknown web method [object Object].<br>Parameter name: methodName</i> </h2></span>
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<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.We开发者_StackOverflowb.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)
1 - I think that your answer is there:
How to call webservice in Javascript for Firefox 3.0
It illustrates the use of [System.Web.Script.Services.ScriptService()] using a very easy and clean code and style.
2 - Alternativelly, you could use jQuery as illustrated in this answer: How to use jQuery to call an ASP.NET web service?
精彩评论