none
Get a Token from WCF STS

    Question

  • Hi,

    I am new to WIF, I have some doubts in WCF STS

    I have created a WCF STS using WCF Security Token Service Template, hosted in IIS, How to get a token from the WCF STS, When i tried using the following lines throws the errors Sayes "There was no endpoint listening at http://localhost/STSService/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."


    How to Get a Token ?

    The code i used as follows

     

    WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(new WS2007HttpBinding(), new EndpointAddress("http://localhost/STSService/Service.svc"));

     

     

    WSTrustChannel channel = (WSTrustChannel)trustChannelFactory.CreateChannel();

     

     

    RequestSecurityToken rst = new RequestSecurityToken(RequestTypes.Issue);

    rst.AppliesTo =

     

    new EndpointAddress("http://localhost/CalculatorService");

     

     

    RequestSecurityTokenResponse rstr = null;

     

     

    SecurityToken token = channel.Issue(rst, out rstr);

    Thanks,
    Siva.

    Tuesday, February 16, 2010 6:50 AM

Answers

  • Hi Vani,

    Thanks for your reply, The problem is solved now,

    There was 2 problems
    1) I haven't mentioned the Endpoint Identity in the Endpoint Address, Now i Passed it.

    EndpointIdentity id = EndpointIdentity.CreateX509CertificateIdentity( 
                          CertificateUtil.GetCertificate(StoreName.My, StoreLocation.LocalMachine, STSCertificateSubjectName));
    
    EndpointAddress ep = new EndpointAddress(new Uri(STSAddress), id, new AddressHeaderCollection());
    
    WSTrustChannelFactory channelFactory = new WSTrustChannelFactory(GetSecurityTokenServiceBinding(), ep);
    


    2) I have ReSet my IIS :)

    Thanks,
    Siva.

    • Marked as answer by Sivakumar K Thursday, February 18, 2010 7:04 AM
    Thursday, February 18, 2010 7:03 AM

All replies

  • Hi Siva,

    Can you verify that you can browse to http://localhost/STSService/Service.svc?

    Thanks,
    Vani.

    Wednesday, February 17, 2010 9:55 PM
  • Hi Vani,

    Thanks for your reply, The problem is solved now,

    There was 2 problems
    1) I haven't mentioned the Endpoint Identity in the Endpoint Address, Now i Passed it.

    EndpointIdentity id = EndpointIdentity.CreateX509CertificateIdentity( 
                          CertificateUtil.GetCertificate(StoreName.My, StoreLocation.LocalMachine, STSCertificateSubjectName));
    
    EndpointAddress ep = new EndpointAddress(new Uri(STSAddress), id, new AddressHeaderCollection());
    
    WSTrustChannelFactory channelFactory = new WSTrustChannelFactory(GetSecurityTokenServiceBinding(), ep);
    


    2) I have ReSet my IIS :)

    Thanks,
    Siva.

    • Marked as answer by Sivakumar K Thursday, February 18, 2010 7:04 AM
    Thursday, February 18, 2010 7:03 AM