使用 SilverLight 从 MailChimp 获取数据

发布于 2024-12-06 17:54:39 字数 873 浏览 0 评论 0原文

我创建了自己的 silverlight API 来从 MailChimp 获取/设置数据。 它工作得很好,但今天我收到了一个错误。示例代码是:

string MailChimpURL =  "https://us2.api.mailchimp.com/1.3/?method=lists&apikey=my_api_key-us2";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(MailChimpURL));
request.BeginGetResponse(new AsyncCallback(ReadCallback), request);

private void ReadCallback(IAsyncResult asynchronousResult)
{
    HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
    using (StreamReader streamReader1 = new StreamReader(response.GetResponseStream()))
    {
        string resultString = streamReader1.ReadToEnd();
    }
}

这适用于 http,但在使用 https 时会出现错误。 https 是昨天的错误。几个月前,http 和 https 都运行良好。现在它只适用于http。

这是我的代码中的问题还是来自 MailChimp 的问题。

I have created my own silverlight API to get/set data from/to MailChimp.
It was working fine, but today I am getting an error. Example code is :

string MailChimpURL =  "https://us2.api.mailchimp.com/1.3/?method=lists&apikey=my_api_key-us2";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(MailChimpURL));
request.BeginGetResponse(new AsyncCallback(ReadCallback), request);

private void ReadCallback(IAsyncResult asynchronousResult)
{
    HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
    using (StreamReader streamReader1 = new StreamReader(response.GetResponseStream()))
    {
        string resultString = streamReader1.ReadToEnd();
    }
}

This works fine with http but gives error when using https.
The error which https is for yesterday. Months back it was working fine for both http and https. Now its only working for http.

Is this a problem in my code or this from MailChimp.

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

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

发布评论

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

评论(1

夜血缘 2024-12-13 17:54:39

我不认为你向我们展示了真正的例外。您在调试时总是会遇到检查 AsyncWaitHandle 属性时看到的异常,因为 Siverlight 不支持该属性。

您确实需要在 ReadCallBack 中放置一些错误处理,以便您可以以友好的方式向 UI 报告任何可能出现的错误。

I don't think you are showing us the true exception. The exception you are seeing when inspecting the AsyncWaitHandle property you will always get when debugging because Siverlight does not support that property.

You really need to place some error handling in your ReadCallBack so you can report back to the UI in a friendly way anything that may have gone wrong.

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