[英]The request was aborted: Could not create SSL/TLS secure channel .Net 4.5.2
Please someone help me, when I invoke 3rd party webservice, it shows : 当我调用第三方网络服务时,请有人帮助我,它显示:
Initializing
Generating WSDL
System.InvalidOperationException: General Error https://xxx ---> System.Net.WebException: There was an error downloading 'https:/xxx'. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Discovery.DiscoveryClientProtocol.Download(String& url, String& contentType)
--- End of inner exception stack trace ---
at System.Web.Services.Discovery.DiscoveryClientProtocol.Download(String& url, String& contentType)
at System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoverAny(String url)
at WebServiceStudio.Wsdl.ProcessRemoteUrls(DiscoveryClientProtocol client, StringCollection urls, XmlSchemas schemas, ServiceDescriptionCollection descriptions)
--- End of inner exception stack trace ---
at WebServiceStudio.Wsdl.ProcessRemoteUrls(DiscoveryClientProtocol client, StringCollection urls, XmlSchemas schemas, ServiceDescriptionCollection descriptions)
at WebServiceStudio.Wsdl.Generate()
I Already try using X509 Certificate, give user everyone full permission. 我已经尝试使用X509证书,给用户所有人完全许可。
This may occur when the SSL certificate of the web service is not valid. 当Web服务的SSL证书无效时,可能会发生这种情况。
For a workaround, try the following code: 要解决此问题,请尝试以下代码:
System.Net.ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(delegate
{
return true;
});
If this fixes your issue, then you should check the certificate on your machine. 如果这解决了您的问题,则应检查计算机上的证书。
As @dman2306 says, this is merely to check whether the certificate is the cause of your issues. 正如@ dman2306所说,这仅是为了检查证书是否是造成您问题的原因。 Do not use this in any production code.
请勿在任何生产代码中使用此代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.