Aspnetcore.docs: Additional information about endpoint-routing

Created on 27 Sep 2019  Â·  4Comments  Â·  Source: dotnet/AspNetCore.Docs

From my point of view this chapter should have additional information about Endpoint-Routing and needed changes. Do i have missed the content somewhere?

Many articles are writing that we have to change the calls to something like

app.UseEndpoints(x =>
{
    x.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
});

without mentioning that some things are broken like Attribute-Routing. I am unable to access controllers or methods by using [Route(..)] nor [HttpGet(..)].
A call of MapControllers() (instead of MapControllerRoute(..)) didn't fixed the issue either. I hoped there would be some more information about that.

If i understood it correctly the usage of AddMvc() should not be used anymore in the future because enpoint routing offers a better performance and more possibilities for middleware.

Unfortunately the page https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-3.0 doesn't provide information about this either.
Unfortunately i am running from one issue into another without getting information how to resolve them.
I even used a plain simple new Asp.Net Core project (created by VS 2019) to avoid any project-specific issues.

EDIT 2019-09-27: Typo fixed


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

PU Source - Docs.ms doc-enhancement

Most helpful comment

A short update from my side:
I read the migration-documentation from 2.2 to 3.0 another time. There it says you have to use

 app.UseEndpoints(endpoints => {
  endpoints.MapControllers();
});

to enable Attribute-Routing. It seems that this documentation should be updated as well then (or no one besides me uses attribute routing or found another workaround).

All 4 comments

@rynowak can you assign someone to update this routing doc for endpoint-routing?

A short update from my side:
I read the migration-documentation from 2.2 to 3.0 another time. There it says you have to use

 app.UseEndpoints(endpoints => {
  endpoints.MapControllers();
});

to enable Attribute-Routing. It seems that this documentation should be updated as well then (or no one besides me uses attribute routing or found another workaround).

Important info for using attribute routing. Thank you. You must also call services.AddControllersWithViews();
within ConfigureServices()

Moved to #13871

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mattacks picture Mattacks  Â·  3Comments

madelson picture madelson  Â·  3Comments

danroth27 picture danroth27  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

AnthonyMastrean picture AnthonyMastrean  Â·  3Comments