TLS 1.2错误-未提供客户端证书。在ClientCredentials

时间:2018-10-15 02:19:05

标签: c# vb.net visual-studio ssl tls1.2

我们有一个最近更改为TLS 1.2的提供商

与此服务的通信是通过VB.NET编写的Web应用程序完成的。

用于以前的安全协议的代码。根据{{​​3}}的回答,我已经更新了代码,但是现在我收到一条错误消息:

The client certificate is not provided. Specify a client certificate in ClientCredentials.

我是否需要安装证书才能使此代码正常工作,如果可以,该怎么办?

Dim binding = New BasicHttpBinding()
binding.Name = "SoapBinding"

binding.Security.Mode = BasicHttpSecurityMode.Transport

binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None
binding.Security.Transport.Realm = ""
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate

Dim NewEndPoint As New EndpointAddress("www.example.com")

Dim _sr As New srT.ConsumerSoapClient(binding, NewEndPoint)

Dim NewSendData As New srT.SomeService

Dim _result As New srT.SomeServiceRepsonse

_result = _sr.ProcessRequest(NewSendData)

上面的代码在VB.NET中,但是我假设答案在C#中是相似的(或相同的)。

谢谢!

1 个答案:

答案 0 :(得分:0)

我更改了以下代码,然后不需要证书(使用.NET 4.6.1):

binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.**None**