aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Allow non-attribute routing for ApiController

Open jez9999 opened this issue 1 year ago • 0 comments

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

ApiControllers 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?

jez9999 avatar Aug 10 '22 15:08 jez9999