aspnetcore
aspnetcore copied to clipboard
Allow non-attribute routing for ApiController
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
I am trying to use non-attribute routing for my ApiController
but when I try to UseEndpoints()
throws the exception:
System.InvalidOperationException: 'Action 'Controllers.Api.WeatherForecastController.Get' does not have an attribute route. Action methods on controllers annotated with ApiControllerAttribute must be attribute routed.'
Describe the solution you'd like
ApiController
s should support non-attribute routing.
Additional context
It's regularly stated that attribute routing becomes a requirement when a controller is an ApiController
. What I don't understand is why. It seems completely arbitrary. Can't it be opened up to non-attribute routing, or does this cause some technical problem?