【发布时间】:2019-01-21 23:51:15
【问题描述】:
在 Asp.Net Core 2.2 控制器操作中,我有以下内容:
var url1 = Url.Action(action: "GetContentByFileId", values: new { FileId = 1 });
var url2 = _linkGenerator.GetUriByAction(HttpContext, action: "GetContentByFileId", values: new { FileId = 1 });
我在 URL1 中获得了正确的 url,但 URL2 为 null ...
我在 Controller 中注入 LinkGenerator 并且它不为空,所以我认为它可以...
知道我错过了什么吗?
【问题讨论】:
标签: asp.net-core