问题描述
我在使用 https Web 服务的 .Net framework 4.6 中有 asmx Web 服务。这是我在调用服务之前的以下代码:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
它在调试模式下工作正常。我可以查看预期的数据,但是在发布模式下运行应用程序或在 vs2017 中没有调试时,我收到以下错误:
Web ServiceSystem.ServiceModel.CommunicationException:
An error occurred while making the HTTP request to https://externalwebservice address.
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.
---> System.Net.WebException: The underlying connection was closed:
An unexpected error occurred on a send.
---> System.IO.IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host.
---> System.Net.sockets.socketException: An existing connection was forcibly closed
by the remote host.
我在 IIS 中安装了一个自签名证书。
我真的很困惑它在调试模式下有效,但在发布模式下无效。 请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)