我想使用下面的代码将下面的JSON Web服务https://mtgox.com/code/data/getDepth.php的结果转换为字符串。Dotnet Web客户端超时,但浏览器工作文件为JSON Web服务
using (WebClient client = new WebClient())
{
string data = client.DownloadString("https://mtgox.com/code/data/getDepth.php");
}
但它总是返回一个超时异常并且没有数据。我打算使用fastjson将响应转化为对象,并期望成为难以回归的页面内容。
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://mtgox.com/code/data/getDepth.php");
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
string data = sr.ReadToEnd();
}
}
也造成了同样的错误。任何人都可以指出我做错了什么?
非常感谢。不能相信我浪费了很多时间来填充所有的设置,并且这是整个浏览器设置的时间。我应该早点问。感谢您的快速回复 – Seer