I use attribute routing , but when I specify an empty attribute Route, I get the following error:
405.0 - method not allowed
However, if I add the route name in the attribute, for example [Route("bar")], everything will work as expected.
Why does one of these action methods work properly while the other gives a 405 error ?
[System.Web.Http.RoutePrefix("foo")]
public partial class MyController : ApiController
{
[System.Web.Http.HttpPost]
[System.Web.Http.Route("bar")]
public async Task<MyResponseModel> BarMethod([FromBody]MyArgumentsModel arguments)
{
}
[System.Web.Http.HttpPost]
[System.Web.Http.Route]
public async Task<MyResponseModel> FooMethod([FromBody]MyArgumentsModel arguments)
{
}
}
Any ideas on what I might lose?
source
share