我想要的是:
在我的应用程序中,我想为我的电子邮件使用模板。不幸的是,我之前在另一个项目中使用的代码不再起作用。
抛出的错误:
Could not find an IRouter associated with the ActionContext.
If your application is using endpoint routing then you can get a IUrlHelperFactory with dependency injection
and use it to create a UrlHelper, or use Microsoft.AspNetCore.Routing.LinkGenerator.'
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题,因为我找不到任何方法来注入IUrlHelper. 我不确定为什么甚至需要这样做,因为无论如何它都不在视图中。
字符串渲染方法:
Could not find an IRouter associated with the ActionContext.
If your application is using endpoint routing then you can get a IUrlHelperFactory with dependency injection
and use it to create a UrlHelper, or use Microsoft.AspNetCore.Routing.LinkGenerator.'
Run Code Online (Sandbox Code Playgroud)