asp.net web api - Mutiple Routes in DNN Service Route Mapper not working -


i starting dnn , trying setup controller , service routes reason not working guess may missing or have wrong understanding in how works

i have controller 2 actions

public class name : dnnapicontroller{    public getapple(string id){    }   public getorange(string id){    } } 

i have created service routes

public class routemapper : iserviceroutemapper {     public void registerroutes(imaproute maproutemanager)     {         maproutemanager.maphttproute("name", "apple1", "{controller}/{action}/{id}", new[] {"myservices"});        maproutemanager.maphttproute("name", "orange2", "{controller}/{action}/{id}", new[] {"myservices"});     } } 

when run 1 of action resolved , 400 other one...

any suggestions? why?

try declaring routes in follwoing way

routemanager.maphttproute("modulename", "apple1", "{controller}/{action}/{id}", new string[] { "yournamespace.services.controllers" }); 

make sure yournamespace replaced name space module , module name

what url requesting service?

this assumes following type of set up:

namespace services.controllers {     public class nameservicecontroller: dnnapicontroller, iserviceroutemapper     {     } } 

also, pretty sure controller class name needs end controller word , when reference url leave out controller

so url format follows:

desktopmodules / [modulename] / api / [controllername (with controller removed form end)] / [action name] / [id]

www.yourportal.com/desktopmodules/modulename/nameservice/apple1/id

hope helps


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -