Upgrade the info about exposing attribute routes to Warning (#17511)
* Upgrade the info about exposing attribute routes to Warning Makes it more obvious you have to do something special, e.g. call MapControllers() to expose attribute only routes on regular (non-API) controllers. If you just comment out the default conventional route and add attribute routes to controllers, it won't work. And it is not immediately obvious why it doesn't work. This change makes those two lines more prominent. * upgrade warning to important Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>pull/17726/head
parent
7476c6b80f
commit
b5b6f87eea
|
@ -87,10 +87,11 @@ Replaces:
|
|||
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
|
||||
```
|
||||
|
||||
Routing is configured using the <xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting*> and <xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints*> middleware. To use controllers:
|
||||
|
||||
* Call <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllers*> inside `UseEndpoints` to map [attribute routed](#ar) controllers.
|
||||
* Call <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute*> or <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapAreaControllerRoute*>, to map [conventionally routed](#cr) controllers.
|
||||
> [!IMPORTANT]
|
||||
> Routing is configured using the <xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting*> and <xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints*> middleware. To use controllers:
|
||||
>
|
||||
> * Call <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllers*> inside `UseEndpoints` to map [attribute routed](#ar) controllers.
|
||||
> * Call <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute*> or <xref:Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapAreaControllerRoute*>, to map [conventionally routed](#cr) controllers.
|
||||
|
||||
<a name="routing-conventional-ref-label"></a>
|
||||
<a name="crd"></a>
|
||||
|
|
Loading…
Reference in New Issue