简体   繁体   English

SOAP错误:请求已中止:无法创建SSL / TLS安全通道

[英]SOAP Error: The request was aborted: Could not create SSL/TLS secure channel

I have created Soap service, using WSDL file. 我已经使用WSDL文件创建了Soap服务。 While testing on SOAP UI (XML part with passing header and client id,secret) it is giving proper response. 在SOAP UI(带有传递标头和客户端ID,秘密的XML部分)上进行测试时,它会给出正确的响应。 But through service gives error 但是通过服务会出错

The request was aborted: Could not create SSL/TLS secure channel 该请求已中止:无法创建SSL / TLS安全通道

Can someone analise code my service look like : 有人可以对我的服务进行analise编码,如下所示:

    Dim Request As WebRequest
    Dim Response As WebResponse
    Dim DataStream As Stream
    Dim Reader As StreamReader
    Dim SoapByte() As Byte
    Dim pSuccess As Boolean = True
    Dim SD2Request As String

    SoapByte = System.Text.Encoding.UTF8.GetBytes(MyXMLString)

        Dim myCred As System.Net.CredentialCache = New System.Net.CredentialCache()
        Dim netCred As NetworkCredential = New NetworkCredential("testclient", "test@123")
        myCred.Add(New Uri("https://URL"), "Basic", netCred)
        Request = WebRequest.Create("https://URL")
        Request.Headers.Add("Client-ID", "ID-1234")
        Request.Headers.Add("Client-Secret", "Secret-1234")
        Request.PreAuthenticate = True
        Request.ContentType = "application/xml; charset=utf-8"
        Request.ContentLength = SoapByte.Length
        Request.Method = "POST"
        Request.Credentials = myCred
        DataStream = Request.GetRequestStream()
        DataStream.Write(SoapByte, 0, SoapByte.Length)
        DataStream.Close()
        Response = Request.GetResponse()
        DataStream = Response.GetResponseStream()
        Reader = New StreamReader(DataStream)
        SD2Request = Reader.ReadToEnd()
        DataStream.Close()
        Reader.Close()
        Response.Close()
        Return SD2Request

I have imported WSDL file as service reference. 我已导入WSDL文件作为服务参考。

.NET 4.5 hasn't enabled TLS by default. .NET 4.5默认情况下未启用TLS。 You've got to enable it manually by setting the System.Net.ServicePointManager.SecurityProtocol property : 您必须通过设置System.Net.ServicePointManager.SecurityProtocol属性来手动启用它:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 该请求已中止:使用X509Certificate2时无法创建SSL / TLS安全通道 - The request was aborted: Could not create SSL/TLS secure channel when using X509Certificate2 VB。 NET:请求被中止:无法在 WebClient 上创建 SSL/TLS 安全通道 - VB. NET: The request was aborted: Could not create SSL/TLS secure channel on WebClient ASP.NET“请求被中止:无法创建 SSL/TLS 安全通道”也出现在配置的 servicepointmanager 中 - ASP.NET "The request was aborted: Could not create SSL/TLS secure channel" occurs also with configured servicepointmanager VB。 NET:请求被中止:无法创建 SSL/TLS 安全通道 - VB. NET: The request was aborted: Could not create SSL/TLS secure channel XmlReader.Create错误“无法创建SSL / TLS安全通道” - XmlReader.Create error “Could not create SSL/TLS secure channel” 防止错误无法在某些服务器上创建 SSL/TLS 安全通道 - Prevent error could not create SSL/TLS secure channel on some servers 无法为SOAP调用建立SSL / TLS的安全通道 - Could not establish secure channel for SSL/TLS for SOAP call 无法为 SSL/TLS 安全通道建立信任关系 - SOAP 服务 - Could not establish trust relationship for the SSL/TLS secure channel - SOAP Service IIS 阻止我的请求。 无法创建 SSL/TLS 安全通道 - IIS Blocking My Request. Could not create SSL/TLS secure channel 我如何修复 ASP.NET 中的无法创建 SSL/TLS 安全通道错误 - How do i fix the Could not create SSL/TLS secure channel Error in ASP.NET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM