Authentification ADFS avec WCF hébergé sur Windows service

J'ai un service wcf qui interroge ADFS pour jeton SAML. Il s'agit d'un extrait à partir du web pour une requête ADFS et récupérer le jeton SAML.
Cependant, il finit toujours par casser au niveau de la ligne canal de retour.Question(tvd); . L'erreur est ID3082: La demande n'est pas valide ou n'est pas pris en charge.
Au moins à un niveau élevé, je ne suis pas en mesure de déterminer si l'erreur est à la ADFS fin du serveur ou avec la voie de service WCF est configuré ou avec le code. S'il vous plaît aider.

public SecurityToken GetSamlToken()
    {
            using (var factory = new WSTrustChannelFactory(
            new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential),
            new EndpointAddress(new Uri("https://serv/adfs/services/trust/13/usernamemixed"))))
            {
            factory.Credentials.UserName.UserName = "username";
            factory.Credentials.UserName.Password = "password";
            factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
            factory.TrustVersion = TrustVersion.WSTrust13;                
            WSTrustChannel channel = null;                
            try
            {
                string KeyType;
                var rst = new RequestSecurityToken
                              {
                                  RequestType = WSTrust13Constants.RequestTypes.Issue,
                                  AppliesTo = new EndpointAddress("net.tcp://localhost:xxxx/Service1/mex"),                         
                                  KeyType = Microsoft.IdentityModel.Protocols.WSTrust.WSTrust13Constants.KeyTypes.Bearer,                                        
                              };

                channel = (WSTrustChannel)factory.CreateChannel();

                return channel.Issue(rst);
            }
            finally
            {
                if (channel != null)
                {
                    channel.Abort();
                }

                factory.Abort();
            }
        }
    }

OriginalL'auteur simba | 2013-10-16