twilio-csharp 在 Mono 中工作吗?

发布于 2024-12-06 23:11:44 字数 372 浏览 0 评论 0原文

你好,我最近一直在摆弄 Twilio 和他们的官方 twilio-csharp 库。我在 Linux 上的 mono 2.10.5(x86-64) 上使用它,但在运行基本示例时遇到问题。

我的代码:

var twilio = new TwilioRestClient("[accountsid]", "[authkey]");
var msg = twilio.SendSmsMessage("+1316313XXXX, "+1918917XXXX", "I'm a monkey Mr. Anderson");

看起来很简单,但是运行它时,返回的 msg 对象为 null 并且没有发送消息。这是我做错了什么还是这个库不能在 Mono 中工作?

Hello I've recently been messing around with Twilio and their official twilio-csharp library. I'm using it on mono 2.10.5(x86-64) on Linux and I'm having problems getting a basic example working.

My code:

var twilio = new TwilioRestClient("[accountsid]", "[authkey]");
var msg = twilio.SendSmsMessage("+1316313XXXX, "+1918917XXXX", "I'm a monkey Mr. Anderson");

Seems to be very simple but when running it, the msg object returned is null and no message gets sent. Is this something I'm doing wrong or does the library not work in Mono?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乞讨 2024-12-13 23:11:44

此页面详细介绍了该问题: http://www.mono-project.com/UsingTrustedRootsRespectively

基本上,Mono 不附带任何根证书颁发机构。因此,快速而肮脏的解决方法是信任所有证书:

ServicePointManager.ServerCertificateValidationCallback = 
                delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
                    { return true; };

这不是很安全,但根据您的用途,这可能并不重要。

The problem is detailed in this page: http://www.mono-project.com/UsingTrustedRootsRespectfully

Basically, Mono doesn't ship with any root certificate authorities. So, the quick and dirty fix is to trust all certificates:

ServicePointManager.ServerCertificateValidationCallback = 
                delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
                    { return true; };

It's not very secure, but depending on your uses, it may not matter.

拍不死你 2024-12-13 23:11:44

如果这对遇到这个问题的其他人有帮助,我将 monotouch/for android 项目添加到 twilio-csharp 的这个分支中:

https://github.com/joelmartinez/twilio-csharp

将更改折叠到主项目中的拉取请求是 待定 截至撰写本答案:)

In case it's helpful for anyone else that come across this question, I added monotouch/for android projects to this fork of twilio-csharp:

https://github.com/joelmartinez/twilio-csharp

pull request to fold the changes into the main project is pending as of the writing of this answer :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文