c# - Method not found: 'System.Web.Http.ApiController.get_Request()' -
i have azure web app, , when calling web api controller post method i've been getting following exception:
method not found: 'system.net.http.httprequestmessagesystem.web.http.apicontroller.get_request()'
i can't reproduce error when running app locally, happens on azure.
here controller's code:
using system; using system.net; using system.net.http; using system.web.http; using tfl.bl; using tfl.bo; using tfl.web.dto; namespace tfl.webapi.controllers { public class searchcontroller : apicontroller { public httpresponsemessage get() { return request.createresponse(200); } // post: api/search public httpresponsemessage post([frombody]searchdto dto) { search s = new search(); s.firstname = dto.firstname; s.lastname = dto.lastname; s.email = dto.email; s.birthdate = dto.birthdate; s.city = dto.city; s.country = dto.country; s.fromage = convert.toint32(dto.fromage); s.gender = convert.toint32(dto.gender); s.imagepath = dto.imagepath; s.pagenumber = convert.toint32(dto.pagenumber); s.pathurl = dto.pathurl; s.professionid = convert.toint32(dto.professionid); s.state = dto.state; s.str = dto.str; s.tags = null; s.toage = convert.toint32(dto.toage); s.typeid = convert.toint32(dto.typeid); s.culture = dto.culture; return request.createresponse(httpstatuscode.accepted, searchbl.getlist(s)); } // put: api/search/5 public void put(int id, [frombody]string value) { } // delete: api/search/5 public void delete(int id) { } } }
stack trace:
at tfl.webapi.controllers.searchcontroller.post(searchdto dto) ↵ @ lambda_method(closure , object , object[] ) ↵ @ system.web.http.controllers.reflectedhttpactiondescriptor.actionexecutor.<>c__displayclass10.<getexecutor>b__9(object instance, object[] methodparameters) ↵ @ system.web.http.controllers.reflectedhttpactiondescriptor.actionexecutor.execute(object instance, object[] arguments) ↵ @ system.web.http.controllers.reflectedhttpactiondescriptor.executeasync(httpcontrollercontext controllercontext, idictionary`2 arguments, cancellationtoken cancellationtoken) ↵--- end of stack trace previous location exception thrown --- ↵ @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) ↵ @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) ↵ @ system.web.http.controllers.apicontrolleractioninvoker.<invokeactionasynccore>d__0.movenext() ↵--- end of stack trace previous location exception thrown --- ↵ @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) ↵ @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) ↵ @ system.web.http.controllers.actionfilterresult.<executeasync>d__2.movenext() ↵--- end of stack trace previous location exception thrown --- ↵ @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) ↵ @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) ↵ @ system.web.http.dispatcher.httpcontrollerdispatcher.<sendasync>d__1.movenext()
i can't reproduce error when running app locally, happens on appreciate given!
i tested code on side , worked on azure web app. since worked on development machine, please check following option remove additional files before publish.
Comments
Post a Comment