![](/img/trans.png)
[英]Identity server 4 OpenId Connect redirect to /Account/AccessDenied
[英]Register IIdentityServerInteractionService in Identity Server 4 for OpenID Connect
我正在尝试按照本教程使用从Identity Server 4文档添加OpenID Connect的用户身份验证,但是当我启动mvc客户端时出现以下错误:
InvalidOperationException:尝试激活“IdentityServer4.Quickstart.UI.HomeController”时,无法解析类型“IdentityServer4.Services.IIdentityServerInteractionService”的服务。
如何注册身份服务器交互服务 ? 它听起来像DI的问题。
当依赖项注入容器中没有可用的接口IIdentityServerInteractionService
时,会出现此错误。 Quickstart示例的HomeController请求在构造函数中实现IIdentityServerInteractionService
:
public HomeController(IIdentityServerInteractionService interaction)
{
_interaction = interaction;
}
你应该添加services.AddIdentityServer();
在启动类的ConfigureServices
方法中。 IdentityServer将注入的实现IIdentityServerInteractionService
,namingly的DefaultIdentityServerInteractionService
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.