【问题标题】:I'm getting error Upgrade Required while integrating twilio whatsapp in c#在 c# 中集成 twilio whatsapp 时出现错误 Upgrade Required
【发布时间】:2019-04-05 05:59:45
【问题描述】:

这是我在尝试发送消息时遇到的错误。

“Twilio.Exceptions.ApiException”类型的未处理异常 发生在 Twilio.dll
附加信息:需要升级

我的代码是:

const string accountSid = "Value";
const string authToken = "Value";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+whatsapp:+13233633791");
var message = MessageResource.Create(
    to,
    from: new PhoneNumber("+whatsapp:+12037179461"),
    body: "Hi Joe! Your order D45987AB will arrive on 8/12/2018 before 8 pm.");
    Console.WriteLine(message.Sid);

【问题讨论】:

标签: twilio twilio-api


【解决方案1】:

根据他们的文档,Twilio API 现在需要 TLS v1.2 和字符串密码套件。

在您的方法中,在调用 MessageResource.Create() 之前,添加

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                | SecurityProtocolType.Tls11
                                                | SecurityProtocolType.Tls12
                                                | SecurityProtocolType.Ssl3;

【讨论】:

    【解决方案2】:

    我可以通过设置来解决这个问题:

    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //TLS 1.2
    

    在我的应用程序的开头。

    您还可以阅读此 github 链接问题: https://github.com/twilio/twilio-csharp/issues/472

    【讨论】:

    • 非常感谢,经过这么多尝试终于解决了这个解决方案,节省了我的时间
    【解决方案3】:

    我将 .Netframework 升级到了我的应用程序的 4.7.1。以及它现在的工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-08
      • 2019-07-04
      • 1970-01-01
      • 2022-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多