WCF传输与https通信与证书问题
本文关键字:证书 问题 通信 https 传输 WCF | 更新日期: 2023-09-27 18:10:07
我有一个托管在IIS服务器上的web应用程序,它与安装在同一服务器上的web服务通信。Web服务作为标准服务安装,而不是通过IIS。
服务已经启动并运行,我可以使用https在浏览器中导航到它。我使用netsh添加证书:通过证书实现传输安全的WCF
然而,当web应用程序试图调用web服务时,我得到以下错误:
An error occurred while making the HTTP request to https://TheServer/VehicleService/ConnectXml/1.0/https. 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.
我进一步查看了错误,发现如下:
<ExceptionType>System.IO.IOException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.</Message>
<ExceptionType>System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The underlying connection was closed: An unexpected error occurred on a send.</Message>
有谁知道是什么导致了这个问题吗?我需要向IIS添加任何额外的配置吗?
我已经尝试在本地添加证书,它对我来说很好。
您的安全协议类型可能未启用(从Windows注册表)。如果你也得到这个:
System.IO.IOException: Unable to read data from the transport connection
尝试以下协议类型之一:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; // Tls, Tls11, or Tls12