I need to implement a Method in my web service, which is available by a defined route.
So I used the Route
attribute like this:
[Route("api/New")]
public void CreateNew(int id)
{
//Do stuff
}
But VS2013 says that the namespace "Route" can't be found.
I guess this can be solved by installing a nuget package.
Can anybody help?
Attribute Routing is native in ASP.NET MVC 5, or later, and ASP.NET Web API 2. check your MVC version it should be above the 4.
Install-Package AttributeRouting (for MVC)
Install-Package AttributeRouting.WebApi (for Web API)
Install-Package AttributeRouting.WebApi.Hosted (for self-hosted Web API)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With