title: WIF SAML RequestSecurityToken STS Internal server error
body: <p>I try to reach my STS to request a token. The code is based on a blog post by @leastprivilege : <a href="http://leastprivilege.com/2012/11/16/wcf-and-identity-in-net-4-5-external-authentication-with-ws-trust/" rel="nofollow">WCF and Identity in .NET 4.5: External Authentication with WS-Trust</a>. I use the explicit approach (by code).</p>
  
  <pre><code>    private static SecurityToken RequestSecurityToken()
  {
              // set up the ws-trust channel factory
              var factory = new WSTrustChannelFactory(
                  new UserNameWSTrustBinding(
                    SecurityMode.TransportWithMessageCredential),
                    "https://federation.mydomain/adfs/services/trust/mex") { TrustVersion = TrustVersion.WSTrust13 };
  
              //factory.Credentials.SupportInteractive = false;
              factory.Credentials.UserName.UserName = "user-pcote";
              factory.Credentials.UserName.Password = "123456";
  
              // create token request
              var rst = new RequestSecurityToken
              {
                  RequestType = RequestTypes.Issue,
                  KeyType = KeyTypes.Symmetric,
                  AppliesTo = new EndpointReference("https://myRP/")
              };
  
              var channel = factory.CreateChannel();
              return channel.Issue(rst);
          }
  </code></pre>
  
  <p>I can see the XML when copying the STS endpoint adress in my browser, therefore the federation server is reachable. But I always get an internal server error (500) as soon as I issue the token request. Does anybody have an idea what could be my problem here.  </p>