locked
The authentication endpoint Username was not found on the configured Secure Token Service RRS feed

  • Question

  • After I deploy ADFS and  IFD in dynamics crm2013, I met this question,I can't connect  the organization service in my web application  using the code 

     public static IOrganizationService GetService(string OURL, string DURL, string UserName, string PassWord)
            {
                Uri organizationUri = new Uri(OURL);
                Uri discoveryUri = new Uri(DURL);
    
                //to ignore certificates errors
                ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;
    
                ClientCredentials userCredentials = new ClientCredentials();
                userCredentials.UserName.UserName = UserName;
                userCredentials.UserName.Password = PassWord;
    
                IServiceConfiguration<IDiscoveryService> discoveryConfiguration = ServiceConfigurationFactory.CreateConfiguration<IDiscoveryService>(discoveryUri);
                SecurityTokenResponse userResponseWrapper = discoveryConfiguration.Authenticate(userCredentials);
                var _discServiceProxy = new DiscoveryServiceProxy(discoveryConfiguration, userResponseWrapper);
                IServiceConfiguration<IOrganizationService> serviceConfiguration = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organizationUri);
                var serviceProxy = new OrganizationServiceProxy(serviceConfiguration, userResponseWrapper);
                serviceProxy.EnableProxyTypes();
                IOrganizationService service = (IOrganizationService)serviceProxy;
                return service;
            }
    and it throws an exception "

    The authentication endpoint Username was not found on the configured Secure Token Service!",but  when  I access the organization url and the discovery url in the browser ,they  are both   fine,so I don't understand why, this is the first question .

    The second question, when I use  the https discovery url  in the plugin registration ,  it throws an exception again  like this 

    I'm sure that  the username and password  is totally correct, by the way ths system is windows server2012R2.

    so does anyone meet the same question with me and have a solution to resolve them please tell me ,thx


    Saturday, June 28, 2014 5:16 AM

All replies