Using Route instead of RoutePrefix at controller level in .net web api attribute routing

Right, this is an expected behavior... RoutePrefix attribute by itself doesn't add any routes to the route table where as Route attributes do...


You are missing it... The route prefix, is just that, a prefix. You should move part of the path template to the route attribute. Like this.

[RoutePrefix("api/v{version}")]
public class BankAccountsController : ApiController
{
    [HttpGet]
    [Route("bank-accounts")]
    public HttpResponseMessage GetBankAccounts(string version)
    {
        //...
    }
}