[英]C# Webclient Download String Zero Result in Json File
我的webClient.Download(“ URI”)函数出现问题。 它有效,因为我必须将URL更改为https(我建议)。 如果我将请求URI粘贴到浏览器中,我将得到一个有效的Json字符串,如果我使用DownloadString(“ URI”)方法对其进行调用,则结果将为零,因为我的代码包含一个密钥,因此在此处删除了该密钥这是我的代码:
var json = "";
Console.WriteLine("Connect zur Google API Geo Coding API");
locations = locations.Replace(" ", "+");
//request the google geocoding api. limit of 2500 requests/day
String requestUri = "https://maps.googleapis.com/maps/api/geocode/json?address=Serba,++Am+Schwemmberg,+Germany";
Console.WriteLine("Hat geklappt");
//get the json string
Console.WriteLine("starte den download des json");
var webClient = new WebClient();
//here it Returns "Zero result"
json = webClient.DownloadString(requestUri);
Console.WriteLine("Download des json beendet");
文档指出必须提供您没有提供的key
参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.