How do I set up RESTful attribute routing in ASP.Net Core API if using Namespace version routing
|Added at||2016-12-28 20:12|
I am building an ASP.Net Core 1.1.0 web API.
As a supporting comment, I have chosen to use Peter Lazzarino's versionrouting NuGet package to allow me to separate my controllers into different namespaces (and folders) based on version. I configured this in my Startup.cs as recommended by Peter and it builds without errors. I am using
in Startup.cs to allow all of my routes to start with api, as per Peter's recommendation.
I want to follow RESTful guidelines and utilize HTTP verb attributes for my methods.
I want my clients to be able to go to http://companyname.com/api/v1/mycontroller/status and since I have MyController located in the the folder "Controllers\v1\MyController.cs" in my API project, the versionrouting library should be able to find it.
Within my controller, I have the following;
However, navigating to http://companyname.com/api/v1/mycontroller/status gives me a 404 error.
I had tried to leave this question as a comment in the SO post How can versioning be done in ASP.NET Core Web Api , but I do not have a high enough reputation yet in StackOverflow to leave a comment. :(
So, hopefully someone here can help me out.
Thanks in advance for any help you can offer.