C# 无法在.net core 3中获取PathByAction

C# 无法在.net core 3中获取PathByAction,c#,.net-core-3.0,C#,.net Core 3.0,从.NETCore2.2迁移到3.0后,我遇到了.NETCore中链接生成器的问题 在2.2中,我可以做到这一点,它为我提供了预期的路径: [Route("/api/store/books")] public class BooksController : Controller { [HttpGet(Name = "GetBooks")] public async Task<IActionResult> GetBooks(string continuation)

从.NETCore2.2迁移到3.0后,我遇到了.NETCore中链接生成器的问题

在2.2中,我可以做到这一点,它为我提供了预期的路径:

[Route("/api/store/books")]
public class BooksController : Controller
{
    [HttpGet(Name = "GetBooks")]
    public async Task<IActionResult> GetBooks(string continuation)
    {
        //...
        var path = linkGenerator.GetPathByAction(HttpContext, nameof(GetBooks), "Books", new { continuation = nextContinuationToken } );
    }
}
为了保持与其他配置的兼容性,我设置了
options.EnableEndpointRouting=false移动到3.0后。当使用端点路由时,一切都如2.2所示


我可以在没有端点路由的情况下使用
GetPathByAction
吗?

谢谢,我启用了端点路由并更改了配置,现在可以正常工作了。
var path = linkGenerator.GetPathByAction(nameof(GetBooks), "Books" );