Search code examples
asp.netajaxjsonjquerywebmethod

While passing multiple args as parameters to web method, "No webservice found at" message is thrown


Below is the web method which I need to access using ajax.:

 [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string CallConfiguredWebService(String projectID,String workType,String Page,String Action,String webServiceName,Object[] arguments)
        {}

I try to access it from script using the below code.

var args = [2];
            args[0] = "Hai";
            args[1] = "Saranya!!";

            $.ajax({
                url: "../../Services/ValidationService.asmx/CallConfiguredWebService?",
                method: "POST",
                data: JSON.stringify({ projectID: '302',workType: 'LFAT',Page: 'Create', Action: 'Create', webServiceName: 'WebService195174',arguments: args}),
                dataType: 'json',
                contentType: 'application/json',
                success: fnsuccesscallback,
                error: fnerrorcallback
            });

I am getting the following error:

500 - Internal server error No service found at /Services/ValidationService.asmx.

I am pretty sure that the url is correct.

I understood from similar posts that it might be because of the parameter mismatch in the ajax call.

I am unable to sort out what is the exact mistake in my code.

Tried using JSON.stringify also.

Pls help with your expertise.

Update:

The ajax call started working after redeploying the web application.


Solution

  • The ajax call started working after redeploying the web application, without making any changes to the code.