we are using the standard license for Geocoding APIs and we observed that there are some intermittent issue with the service response, we get ZERO_RESULTS from API but when we use the same address in browser it works and gives us OK status and it happened for multiple address during that time. but after sometime it started working again. so i am confused if there was down time today between 9 AM 11:30 AM PST.
i checked the console developer dashboard also and i didn't find any error/latency reported by google. i checked the quata also and we just used only 1.5% of daily limit.
here is code
private bool ValidateAddressSearch()
{
Stream dataRecieved = null;
StreamReader reader = null;
XmlDocument xDoc = null;
bool returnVal = true;
WebRequest request = null;
WebResponse response = null;
try
{
request = WebRequest.Create(https://maps.googleapis.com/maps/api/geocode/xml?address=Oak%20Pond%20Ln%20%20Alachua%20Gainesville%20FL%2032608%20US&sensor=false&key=OURKEY);
request.ContentType = "text/xml";
response = request.GetResponse();
if (response != null)
{
dataRecieved = response.GetResponseStream();
reader = new StreamReader(dataRecieved);
string sText = reader.ReadToEnd();
if (!string.IsNullOrEmpty(sText))
{
xDoc = new XmlDocument();
xDoc.LoadXml(sText);
XmlDocumentResponse = xDoc;
returnVal = (xDoc != null && xDoc.HasChildNodes) ? true : false;
}
}
}
catch (Exception ex)
{
//Trace.Write(ex);`enter code here`
returnVal = false;
}
finally
{
dataRecieved = null;
reader = null;
request = null;
response = null;
}
return returnVal;
}
this issue happens randomly multiple times in a month.
Thanks Alok
You might have been seeing this bug: https://code.google.com/p/gmaps-api-issues/issues/detail?id=10585
It's marked as fixed now.
you can try update your url
Google geocode api doesn't work ,if address has space. so for get it working you have to replace all space in your url with '+' as seems below
来源:https://stackoverflow.com/questions/39779030/geocoding-api-issue-zero-results-in-api-response-but-works-in-browser