c# - Error in asp.net webservice -
my asmx webservice this
using system; using system.collections.generic; using system.data; using system.web; using system.web.script.services; using system.web.services; using newtonsoft.json; [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [scriptservice] public class getraterequestdata : webservice { [webmethod] [scriptmethod(responseformat = responseformat.json)] public string getparcellookupdata() { return jsonconvert.serializeobject(dataset, formatting.indented); } }
and trying access data in browser this
http://localhost:53569/services/getraterequestdata.asmx/getparcellookupdata/
but throws error like
system.invalidoperationexception: getparcellookupdata/ web service method name not valid. @ system.web.services.protocols.httpserverprotocol.initialize() @ system.web.services.protocols.serverprotocolfactory.create(type type, httpcontext context, httprequest request, httpresponse response, boolean& abortprocessing)
i new webservices, can 1 point out doing wrong here?
you can decorate method allow http requests
[webmethod] [scriptmethod(usehttpget=true)] public string mymethod(int myint) { // ... code here }
and change config below
<system.web> <webservices> <protocols> <add name="httpget"/> </protocols> </webservices>
Comments
Post a Comment