2010-04-30 117 views
0

我需要使用Windows窗体应用程序连接到提供商的Web服务。他给我一个证书来访问它,但我有一个安全问题。

我完成这些步骤如下:访问Securised Web服务

  1. 证书添加到个人存储(在IE &火狐)
  2. 生成与远程WSDL代理(没问题)
  3. 使用此代码调用的方法:

    `使用(service1.MessagesService M =新service1.MessagesService()){

    X509Certificate crt = new X509Certificate(@“C:\ OpenSSL \ bin \ thecert.p12”,string.Empty);
    m.ClientCertificates.Add(crt);
    var result = m.AuthoriseTransaction(aut);

    this.textBox1.AppendText(result.id.ToString());
    }`

我有以下错误:
基础连接已关闭:无法建立通道SSL/TLS的信任关系。

感谢您的帮助

回答

1

您的连接没有被正确授权,是Web服务通过https?您可能需要创建一个自定义的实现CertificatePolicy。一个例子见article