This is a migrated thread and some comments may be shown as answers.

Application.Unknown web method GetCompanyNames.

1 Answer 424 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 19 Apr 2014, 04:02 PM
Hi all,

I am trying to use the component AutoCompleteBox with a local Webservice. But I got an issue.

So I run Fiddler webdebug, and I can see an error 500, in the detail, I saw:

POST http://localhost:49257/agent/Ws/_WS_SearchCity.asmx/GetCompanyNames HTTP/1.1
Accept: */*
X-Requested-With: XMLHttpRequest
Content-Type: application/json; charset=utf-8
Referer: http://localhost:49257/agent/AcquereurAction.aspx?aID=8&sID=2c0d3ed4-4d34-4ce0-b437-70cf387c56e2
Accept-Language: fr-FR
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Host: localhost:49257
Content-Length: 122
DNT: 1
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=pdwak0ep3ear4yj3nzsvv2ae

{"context":{"Text":"puteaux","MaxResultCount":-1,"IsCaseSensitive":false,"ClientData":"ClientData_Passed_To_The_Service"}}



And the detail is:

Server Error in '/agent' Application.Unknown web method GetCompanyNames.
Parameter name: methodName 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. 

Exception Details: System.ArgumentException: Unknown web method GetCompanyNames.
Parameter name: methodName

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
Stack Trace: 

[ArgumentException: Unknown web method GetCompanyNames.
Parameter name: methodName]
System.Web.Script.Services.WebServiceData.GetMethodData(String methodName) +216
System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName) +63
System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context) +298
System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +185
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +119
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +226
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +145
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155






However, my code folow this sample


http://www.telerik.com/help/aspnet-ajax/autocompletebox-databinding-webservice.html













1 Answer, 1 is accepted

Sort by
0
Michel
Top achievements
Rank 1
answered on 19 Apr 2014, 04:16 PM
I just found out why.

I remove STATIC from the code below, and now it works

[WebMethod]

public AutoCompleteBoxData GetCompanyNames(object context)

{

Tags
AutoCompleteBox
Asked by
Michel
Top achievements
Rank 1
Answers by
Michel
Top achievements
Rank 1
Share this question
or