我有一个要发布为RSS -> json的谷歌文档电子表格,我正在使用下面的代码来检索它:
public void getDocData()
{
String url = "https://spreadsheets.google.com/blah blah blah/basic?alt=json";
using (var w = new WebClient())
{
//here's where the problem is
String json_data = w.DownloadString(url);
//blah blah parse json_data;
}
}我的问题是DownloadString占用了非常长的时间(10-15秒),我完全不知道为什么。奇怪的是,我有一个node/javascript应用程序,它使用完全相同的链接和一个http.get请求,并且没有同样的问题。
有谁有什么想法吗?
发布于 2013-06-14 02:05:07
根据你的症状,我倾向于认为谷歌文档与此无关。您是否尝试过调查与WebClient直接相关的类似问题?例如,确保它没有代理解析问题:
using (var w = new WebClient())
{
w.Proxy = null;
...发布于 2013-06-14 01:51:38
尝试使用异步msdn
public void getDocData()
{
String url = "https://spreadsheets.google.com/blah blah blah/basic?alt=json";
using (var w = new WebClient())
{
//here's where the problem is
String json_data = w.DownloadStringAsync(url);
//blah blah parse json_data;
}
}more details
https://stackoverflow.com/questions/17093669
复制相似问题