gpt4 book ai didi

c# - 在 Identity Server 4 中为 OpenID Connect 注册 IIdentityServerInteractionService

转载 作者:太空狗 更新时间:2023-10-29 21:04:05 25 4
gpt4 key购买 nike

我正尝试在 Adding User Authentication with OpenID Connect 上学习本教程来自 Identity Server 4 文档,但在启动 mvc 客户端时出现以下错误:

InvalidOperationException: Unable to resolve service for type 'IdentityServer4.Services.IIdentityServerInteractionService' while attempting to activate 'IdentityServer4.Quickstart.UI.HomeController'.

如何注册 Identity Server Interaction Service?这听起来像是 DI 的问题。

最佳答案

当依赖项注入(inject)容器中的接口(interface) IIdentityServerInteractionService 没有可用的实现时,您会收到此错误。快速入门示例的 HomeController 请求在构造函数中实现 IIdentityServerInteractionService:

public HomeController(IIdentityServerInteractionService interaction)
{
_interaction = interaction;
}

您应该在启动类的ConfigureServices 方法中添加services.AddIdentityServer();。 IdentityServer 将注入(inject) IIdentityServerInteractionService 的实现,命名为 DefaultIdentityServerInteractionService

关于c# - 在 Identity Server 4 中为 OpenID Connect 注册 IIdentityServerInteractionService,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41597465/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com