the authentication endpoit username was not found on the configured secure token service

本文介绍了解决ADFS与CRM端口冲突的问题,具体分析了端口808被CRM服务与ADFS同时占用导致的问题,并提供了一种简单有效的解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载:http://luoyong0201.blog.163.com/blog/static/11293052015101395013914/

使用Developer Toolkit在Visual Studio中使用CRM Explorer链接到CRM的时候回报如下错误:The authentication endpoint Username was not found on the configured Secure Token Service! 可能在代码中链接CRM也会报这个错误,还有就是在Outlook客户端中使用CRM也会报错。很多文章都认为是要启动AD FS的 URL 路径为 /adfs/services/trust/13/username 的 终结点,我尝试了,没有解决我的问题。



你可能会在AD FS的日志中看到类似如下的错误信息,该错误的事件ID是 102:
启用联合身份验证服务的终结点时出错。请使用 PowerShell cmdlet 纠正配置错误,然后重新启动联合身份验证服务。 
其他数据 
异常详细信息: 
System.ServiceModel.AddressAlreadyInUseException: 已有针对 IP 终结点 0.0.0.0:808 的侦听器。如果有其他应用程序已在侦听此终结点,或者,如果在服务主机中具有多个服务终结点,这些终结点具有相同的 IP 终结点但绑定配置不兼容,则可能会发生这种情况。 ---> System.Net.Sockets.SocketException: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。
   在 System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   在 System.Net.Sockets.Socket.Bind(EndPoint localEP)
   在 System.ServiceModel.Channels.SocketConnectionListener.Listen()
   --- 内部异常堆栈跟踪的结尾 ---
   在 System.ServiceModel.Channels.SocketConnectionListener.Listen()
   在 System.ServiceModel.Channels.ExclusiveTcpTransportManager.OnOpen()
   在 System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   在 System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   在 System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.TcpChannelListener`2.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 Microsoft.IdentityServer.ServiceHost.STSService.StartSTSService(ServiceHostManager serviceHostManager, ServiceState serviceState)

这个我的前一篇文章  Dynamics CRM 2013 IFD部署之五 已经提到过了,重要的事情要说三遍。在前面我提到的文档(Configuring Claims-based Authentication for Microsoft Dynamics CRM Server)的 AD FS port conflict 章节也有说。当然,如果你的AD FS服务器和CRM服务器不是同一台则没有这个问题,这个问题官方说的原因是CRM的 Microsoft Dynamics CRM 沙盒处理服务 (英文是Sandbox Processing Service)侦听808端口,CRM的另外两个服务Microsoft Dynamics CRM Asynchronous Service 和 Web Application Server services 会通过808端口和它交互,而AD FS服务默认也是占用808端口,所以导致了端口冲突 。
解决办法很简单,使用管理员身份打开PowerShell,执行如下命令:Set-ADFSProperties –nettcpport 809 

找到名称为 Active Directory Federation Services 的服务,右击选择 重新启动 。

就可以了


再次申明:博客内容是转载微软CRM的MVP罗勇的

这个错误通常是Spring Security框架中遇到的问题,它表明在当前的请求上下文中没有找到Authentication对象。这可能是由于以下几个原因: 1. **登录认证未完成**:确保用户已经成功通过身份验证并将其信息存储到SecurityContext中。检查login()或authenticate()方法是否被正确调用。 ```java @Autowired private AuthenticationManager authenticationManager; @RequestMapping("login") public String login(@RequestParam String username, @RequestParam String password, Model model) { UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); try { Authentication authentication = authenticationManager.authenticate(authRequest); SecurityContextHolder.getContext().setAuthentication(authentication); return "success"; // 登录成功页面 } catch (AuthenticationException e) { model.addAttribute("error", "Invalid credentials"); return "login"; } } ``` 2. **Session管理问题**:如果使用session,确保在每次请求中都能找到对应的session,并且该session包含了Authentication对象。 3. **清除SecurityContext**:如果你在某些特定场景下需要清空SecurityContext,记得在适当的地方添加`SecurityContextHolder.clearContext()`,但在一般情况下这不是推荐的做法。 4. **Spring Boot Actuator检查**:如果是Actuator端点引发的问题,可能需要排除actuator相关安全设置。 5. **代码错误或配置遗漏**:检查应用的security.xml或application.properties文件中的Spring Security配置,确认是否正确设置了AuthenticationProvider、AuthorizationManager等组件。 修复代码的具体步骤取决于上述排查结果。一旦找到问题所在,修改相应的代码或配置即可。如果问题仍然存在,可以提供更多的上下文信息以便更准确地帮助解决问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值