![](/img/trans.png)
[英].NET The request was aborted: Could not create SSL/TLS secure channel
[英]The request was aborted: Could not create SSL/TLS secure channel .Net 4.5.2
當我調用第三方網絡服務時,請有人幫助我,它顯示:
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()
我已經嘗試使用X509證書,給用戶所有人完全許可。
當Web服務的SSL證書無效時,可能會發生這種情況。
要解決此問題,請嘗試以下代碼:
System.Net.ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(delegate
{
return true;
});
如果這解決了您的問題,則應檢查計算機上的證書。
正如@ dman2306所說,這僅是為了檢查證書是否是造成您問題的原因。 請勿在任何生產代碼中使用此代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.