문제

I have an area called "Location" in which there is a controller called "CountryController". I would like to call the GET action using api/location/country. Is there any way to specify Areas in the default route?

Ideally something like

routeTemplate: "api/{area}/{controller}/{action}/{id}"
도움이 되었습니까?

해결책

You will need to write a custom action selector to achieve selection based on namespaces.

Since it's tough to get right (and get the performance and caching after you do it).

I'd recommend going with attribute routing instead.

다른 팁

Area functionality not available in Asp.Net Web API project, and its harder to maintain with custom way like Namespace based controller.Please visit https://stackoverflow.com/a/34452395/1365663 to get your solution

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top