c# - TLS 1.2 错误 - 未提供客户端证书。在 ClientCredentials 中指定客户端证书

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

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

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

用于与以前的安全协议(protocol)一起工作的代码。根据 WCF error The client certificate is not provided. Specify a client certificate in ClientCredentials 上的回答,我已经更新了代码,但是现在我收到一条错误消息:

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# 中是相似的(或相同的)。

谢谢!

最佳答案

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

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

关于c# - TLS 1.2 错误 - 未提供客户端证书。在 ClientCredentials 中指定客户端证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52808916/

相关文章:

c# - 如何在 ASP.NET Web 表单类中处理类字段?

javascript - 根据选择更改所需输入的邮政编码

visual-studio - 如何单击 Visual Studio 摘要中的链接?

visual-studio - 安装 TFS Powertools 后出现 VS2008 错误

c# - 类 void 放入字典中

java - MineCraft 启动器代码无法使用 CSharp

python - 在 python 中调用 vb dll

c++ - 如何从virustotal.com 中删除恶意软件标记

c# - 问号和点运算符是什么?在 C# 6.0 中是什么意思?

vb.net - 文件图标和 ListView