jquery - Webservice not found by Ajax-Request -


i have ajax-request webservice:

js:

$.ajax( {     type: "post",     url: "getprocess.asmx/getprocessid",     data: "{}",     contenttype: "application/json; charset=utf-8",     datatype: "json",     async: true,     success: function (response) { //much code here, not needed here 

codebehind(getprocess.asmx):

[webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] [system.web.script.services.scriptservice] public class getprocess : system.web.services.webservice {      [system.web.services.webmethod]     [system.web.script.services.scriptmethod(responseformat = responseformat.json)]     public static classes.progress getprocessid()     {         classes.progress progress = new classes.progress();         //alot of code here also. dont think has todo problem.     }    } 

a little part of error, full can find here: http://pastebin.com/z3wmfx3p

[argumentexception]: unknown web method getprocessid. parameter name: methodname    @ system.web.script.services.webservicedata.getmethoddata(string methodname)    @ system.web.script.services.resthandler.createhandler(webservicedata webservicedata, string methodname)    @ system.web.script.services.resthandler.createhandler(httpcontext context)    @ system.web.script.services.resthandlerfactory.gethandler(httpcontext context, string requesttype, string url, string pathtranslated)    @ system.web.script.services.scripthandlerfactory.gethandler(httpcontext context, string requesttype, string url, string pathtranslated)    @ system.web.httpapplication.maphttphandler(httpcontext context, string requesttype, virtualpath path, string pathtranslated, boolean useappconfig)    @ system.web.httpapplication.maphandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute()    @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) 

actually dont see why has problems ?

the problem web method declared static. not allowed - design in web methods in web services should instance methods. should be:

[system.web.services.webmethod] [system.web.script.services.scriptmethod(responseformat = responseformat.json)] public classes.progress getprocessid() 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -