CRM IFD 部署在同一台服务器上遇到的错误

为了学习Dynamics 365,在阿里去上部署一台Dynamics 365服务器。然后实现了IFD 部署。学习的路线还之前的CRM 版本大致一样,这里只是记录一下我遇到的问题及解决问题的思路。

学习CRM的弟一步使用SDK 联接CRM,运行SDK的Sample code,遇到了下面的CODE

Source    : Microsoft.Xrm.Sdk
Method    : GetIssuerEndpoint
Date    : 2017/4/8
Time    : 18:19:05
Error    : The authentication endpoint Username was not found on the configured Secure Token Service!
Stack Trace    : 在 Microsoft.Xrm.Sdk.Client.IssuerEndpointDictionary.GetIssuerEndpoint(TokenServiceCredentialType credentialType)
   在 Microsoft.Xrm.Sdk.Client.AuthenticationCredentials.get_IssuerEndpoint()
   在 Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.AuthenticateInternal(AuthenticationCredentials authenticationCredentials)
   在 Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.AuthenticateFederationInternal(AuthenticationCredentials authenticationCredentials)
   在 Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.Authenticate(AuthenticationCredentials authenticationCredentials)
   在 Microsoft.Xrm.Sdk.Client.DiscoveryServiceConfiguration.Authenticate(AuthenticationCredentials authenticationCredentials)
   在 Microsoft.Xrm.Tooling.Connector.CrmWebSvc.ClaimsIFDFailOverAuth[T](IServiceManagement`1 servicecfg, Uri homeRealm, ClientCredentials userCredentials, ClientCredentials deviceCredentials, Int32 depthLevel, Boolean tryNetworkCred)
   在 Microsoft.Xrm.Tooling.Connector.CrmWebSvc.CreateAndAuthenticateProxy[T](IServiceManagement`1 servicecfg, Uri ServiceUri, Uri homeRealm, ClientCredentials userCredentials, ClientCredentials deviceCredentials, String LogString)
   在 Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials)
   在 Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, NetworkCredential networkCredential)
   在 Microsoft.Xrm.Tooling.Connector.CrmServiceClient.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, NetworkCredential networkCredential)
   在 Microsoft.Xrm.Tooling.CrmConnectControl.CrmConnectionManager.ValidateServerConnection(CrmOrgByServer selectedOrg)
======================================================================================================================
View Code

根据经验觉得应该是部署的IFD 的问题,然后就在部署管理器中禁用了IFD 部署,试着运行代码果然是可以。现在定位是IFD部署的问题了,由于自己知识有限,对ADFS 认识也不足,只能上网找解决办法。搜索一个帖子

http://help.clickdimensions.com/the-authentication-endpoint-username-was-not-found-on-the-configured-secure-token-service-error-when-registering/

按帖子里的方法没有解决我遇到的问题,继续在网上找帖子,万能的互联网,终于在下面的帖子里找到了方法

https://social.microsoft.com/Forums/en-US/31138dff-ed6c-4432-a719-557882e924c6/the-authentication-endpoint-username-was-not-found-on-the-configured-secure-token-service?forum=crm

When installing Microsoft Dynamics CRM on the same server as Windows Server 2012 R2 AD 
FS (not a recommended scenario), you may need to change the port used by AD FS to a port 
other than TCP 808. Sandbox Processing Service listens on Port 808, Microsoft Dynamics CRM 
Asynchronous Service and Web Application Server services communicates with the Sandbox 
Processing Service on Port 808. A port conflict could also cause issues for Microsoft Dynamics 
CRM Email Router, Microsoft Dynamics CRM for Outlook, and the Plug-in Registration Tool.
Check your AD FS event log for EventID 102 and the following in Exception details: 
“System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP 
endpoint 0.0.0.0:808.” 
If this exists, you need to change your AD FS port.
To change the port used by AD FS to another port such as 809, use the following PowerShell 
command: Set-ADFSProperties -nettcpport 809 
Restart AD FS Windows service.
原文地址:https://www.cnblogs.com/hellohongfu/p/6682769.html