c# - Getting the error: “No HTTP resource was found that matches the request URI” in WebAPI and AngularJS -


i'm confused. i'm using asp.net webapi 2 rest api , angularjs spa. application uses 4 rest requests. 1 doesn't work , don't know why.

i've defined process follows:

client-side:

//controller crudservice.getrepo(selfrom, selto).$promise.then(    function (response) {       ...    },    function (err) {       $log.error('mth: ', err);    });  //crudservice function getrepo(selfrom, selto) {    return resservice.ds022.query(       {          from: selfrom,          to: selto       }    ); }  //resservice: function resservice($resource, baseurl) {     return {         ds022: $resource(baseurl + '/api/qr_ds022/mth_test', {             from: '@from',             to: '@to'         }, {})     } } 

and on other hand: server-side (webapi)

[routeprefix("api/qr_ds022")] public class qr_ds022controller : apicontroller {    private testcontext db = new testcontext();     [httpget]    [route("mth_test")]    public iqueryable<getrep_result> getrepos(datetime from, datetime to)    {       var results = db.getrep(from, to).asqueryable();       return results;    } } 

the database model created entity framework 6. have no idea problem is. can see, route defined correctly.

map route 1 place function parameter, try way

public class qr_ds022controller : apicontroller {    private testcontext db = new testcontext();     [httpget]    [route("api/qr_ds022/mth_test/{from}/{to}")]    public iqueryable<getrep_result> getrepos(datetime from, datetime to)    {       var results = db.getrep(from, to).asqueryable();       return results;    } } 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -