使用 SilverLight 从 MailChimp 获取数据
我创建了自己的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你向我们展示了真正的例外。您在调试时总是会遇到检查
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.