System.ArgumentException:已添加具有相同键的项目

2024-05-13

我在 Windows Server 2012 上配置了 ADFS,当我尝试访问时https://abc-idfs.cloudapp.net/adfs/ls/IdpInitiatedSignOn.aspx https://abc-idfs.cloudapp.net/adfs/ls/IdpInitiatedSignOn.aspx我收到一个错误:

Exception details: 
System.ArgumentException: An item with the same key has already been added.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Microsoft.IdentityServer.Web.HomeRealmModule.FindApplicableRealms(ProtocolContext context, Boolean needsIDPInstance)
   at Microsoft.IdentityServer.Web.HomeRealmModule.DiscoverHomeRealm(PassiveProtocolHandler pHandler, ProtocolContext context)
   at Microsoft.IdentityServer.Web.PassiveProtocolListener.GetAuthenticationMethods(PassiveProtocolHandler protocolHandler, ProtocolContext protocolContext)
   at Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext context)

我不明白我哪里出了问题


当我从头开始设置新的 ADFS 服务器时,这种情况发生过很多次。就我而言,我有用于设置服务器的 powershell 代码,但在脚本运行后它总是给我这个错误,所以我知道这是配置中的问题,而不是 ADFS 本​​身的问题。

所以最终问题出在我的情况上:声明提供者标识符需要有 https:// 而不是 http://

要检查此设置的值,请​​打开 AD FS 管理 UI,展开信任关系,选择声明提供者信任,选择您的声明提供者并右键单击并选择属性,然后转到标识符选项卡并查看声明提供者标识符 - 如果此值没有 https:// 并且您正在使用证书来处理服务通信,您将在日志中收到事件 ID 364 以及此确切消息。

364 的发生可能有多种原因,不仅仅是我在这里提到的原因,但这个问题非常简单,很容易被忽视。希望这对某人有帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

System.ArgumentException:已添加具有相同键的项目 的相关文章

随机推荐