locked
Connecting with a SLL webservice using a Proxy class + certificate RRS feed

  • Question

  • I'm currently building a client that consumes a SSL webservice but I'm getting the following error:

    "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure." 

    Ok what have I done so far:

    Webserver:

    I created a certificate with makecert and installed it on the webservice ( IIS ). I installed the certificate on the webserver in the Certificate Store under: Trusted CertificateAuthority.

     

    Client:

    I didnt install the certificate on the client but I read it in my code:

    string strFilename = @"E:\VS2008\Projecten\SecureWebservice\SecureWinForm\server01.pfx";

    X509Certificate2 x509 = new X509Certificate2(strFilename, "pwd");

    X509Store store = new X509Store(StoreName.CertificateAuthority);

    store.Open(OpenFlags.ReadWrite);

    store.Add(x509);

    store.Close();

    testservice client = new testservice();

    client.ClientCertificates.Add(x509);

    MessageBox.Show(client.HelloWorld());

     

    What am i missing here?

    Thank you in advance!

    Dario Leanza

    Tuesday, January 27, 2009 11:18 AM