【问题标题】:how to add soap api reference with ssl certificate in console application .net如何在控制台应用程序 .net 中使用 ssl 证书添加soap api参考
【发布时间】:2021-01-06 07:46:49
【问题描述】:

我是肥皂 API 的初学者。我有一个外部肥皂 API。我试图添加服务参考。但它显示证书错误。我在本地机器上安装了证书。错误如下

    The request was aborted: Could not create SSL/TLS secure channel.

请帮助我如何在 Visual Studio 的控制台应用程序中添加soap API...

【问题讨论】:

    标签: .net visual-studio soap


    【解决方案1】:
    //in .NET 4.0, TLS 1.2 is not supported, but if you have .NET 4.5 (or above) installed on the system
    //then you still can opt in for TLS 1.2 even if your application framework doesn't support it.
    //The only problem is that SecurityProtocolType in .NET 4.0 doesn't have an entry for TLS1.2,
    //so we'd have to use a numerical representation of this enum value:
    //ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
    //instead of:
    // ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
    

    你可以看看这个页面:https://www.codeproject.com/Questions/1255767/Could-not-create-SSL-TLS-secure-channel

    【讨论】:

    • 感谢您的回复。但是我尝试将服务引用添加到我的项目中。因为我在收到此错误时插入了 URL
    • 你能分享你的网址吗?我想试试,我会回答的
    • 对不起!!无法分享。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多