WebAPI2 attribute based routing 404 with nested route
i know there lots of (answered) questions relating attribute-based routing, can’t seem find 1 answers particular scenario.
i’ve got webapi 2 controller, few methods using default routing:
Image may be NSFW.
Clik here to view.
these work fine. i’m trying create nested route below:
Image may be NSFW.
Clik here to view.
for expect url like:
Image may be NSFW.
Clik here to view.
sorry, forgot actual issue 404!
can tell me i’m doing wrong? know can this:
Image may be NSFW.
Clik here to view.
which makes url:
Image may be NSFW.
Clik here to view.
but cleaner api design seems nested route, think.
your assumption wrong in point:
for expect url like:
http://[application_root]/api/sensor/1/suspend?restartat={somedatetime}&site={anint}
it should below:
http://[application_root]/sensor/1/suspend?id=1&restartat={somedatetime}&site={anint}
when specify attribute based routing, overrides default routing architecture of ../api/.. (or whatever specify in route.config file).
so, whenever seek utilize attribute based routing, should /route_prefix_at_controller_level/route_prefix_at_method_level.
asp.net asp.net-web-api web-api asp.net-web-api2 asp.net-web-api-routing
The post WebAPI2 attribute based routing 404 with nested route appeared first on HTML CODE.