As I'm trying to understand them, what are the differences between app.UseRouting()
and app.UseMvcWithDefaultRoute()
?
Probably this link might help you. Basically
I mainly use first approach with mostly razor pages. You can check "Endpoint routing differences from earlier versions of routing" in given link for more information. So, the final decision is whether you want to use Basic or Advanced Endpoint Routing
UseRouting is an advanced method. It just matches request to an endpoint. This is usually followed by useEndpoints() which actually executes matched endpoint. It doesn't necessarily indicate relation between routing and MVC.
UseMvcWithDefaultRoute takes care of everything. It is actually a convenience method for :
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
So it's strictly about MVC, also it follows the default routing(e.g. api/students/1). Nothing advanced.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With