BasicHttpBinding with certificate

Discussion in 'ASP .Net Security' started by Mirco, Jun 21, 2010.

  1. Mirco

    Mirco Guest

    Hi,
    I'm experiencing problem using BasicHttpBinding with client authentication
    with certificate.

    That's the error message: Message:An error occurred while making the HTTP
    request to https://xxx. This could be due to the fact that the server
    certificate is not configured properly with HTTP.SYS in the HTTPS case. This
    could also be caused by a mismatch of the security binding between the client
    and the server.

    Server side:
    ....
    BasicHttpBinding mybinding = new BasicHttpBinding("xxx");
    mybinding.Security.Mode = BasicHttpSecurityMode.Transport;
    mybinding.Security.Transport.ClientCredentialType =
    HttpClientCredentialType.Certificate;
    ....

    Client side:
    ....
    System.ServiceModel.BasicHttpBinding myBinding = new
    System.ServiceModel.BasicHttpBinding();
    myBinding.Security.Mode =
    System.ServiceModel.BasicHttpSecurityMode.Transport;
    myBinding.Security.Transport.ClientCredentialType =
    System.ServiceModel.HttpClientCredentialType.certificate;
    System.ServiceModel.EndpointAddress ea = new
    System.ServiceModel.EndpointAddress("https://xxx");
    xxServiceClient cc = new xxServiceClient(myBinding, ea);
    cc.ClientCredentials.ClientCertificate.Certificate = new
    System.Security.Cryptography.X509Certificates.X509Certificate2();
    cc.ClientCredentials.ClientCertificate.Certificate.Import(@"\\xx");
    ....

    I have already installed the server certificate with httpcfg.exe

    Thanks,
    Mirco
     
    Mirco, Jun 21, 2010
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.