After updating my app from asp.net core 2.1 to 2.2 it seems that default route action is not working for controllers that live in a separate class library.
For example I have a default route like this:
routes.MapRoute(
name: "default",
template: "{controller}/{action}"
,defaults: new { controller = "Home", action = "index" }
);
and in my class library I have a controller SiteAdminController which has an Index action method.
When I visit the url /siteadmin I get the HomeController index and not the index action of the SiteAdminController
if I use /siteadmin/index then it works
How can I make it work without requiring the index action to be explicitly in the url? It worked fine in 2.1
.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
? or the old 2_1 compatibility? (it determines if endpoint routing is used or the mvc router middleware). Can also be disabled separately viaMvcOption
'sEnableEndpointRouting
property – Tseng