After upgrading to Asp.Net Core 2.2 (from Asp.Net Core 2.1), Url.RouteURL seems to be broken.
This repo has code to demonstrate the issue.
In file Startup.cs if you uncomment line setupAction.EnableEndpointRouting = false the URL will get correctly generated other wise URL won't generate.
However by setting EnableEndpointRouting to false we loose the new Routing features introduced with 2.2.
The code for generating URL uses Url.RouteUrl:
Example:
Url.RouteUrl("ControllerOnlyRouteName", new { controller= "MyApi"})
Referred in:
