Geocoding.net icon indicating copy to clipboard operation
Geocoding.net copied to clipboard

Exception thrown when using Geocoding google

Open ludydoo opened this issue 8 years ago • 7 comments

Hi,

I receive this exception (sometimes) when sending geocoding requests

System.AggregateException occurred HResult=0x80131500 Message=One or more errors occurred. Source=mscorlib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Easymage.TEC.Entities.Application.QueryHandlers.AddressSearchQueryHandler.Handle(AddressSearchQuery query) in C:\Users\Ludovic\Source\Repos\Easymage.TEC\Easymage.TEC.Entities.Application\QueryHandlers\AddressSearchQueryHandler.cs:line 32

Inner Exception 1: GoogleGeocodingException: There was an error processing the geocoding request. See Status or InnerException for more information.

ludydoo avatar Sep 28 '17 15:09 ludydoo

See Status or InnerException for more information.

What is the status or inner exception? That is where the error will be.

chadly avatar Sep 28 '17 16:09 chadly

[0] {"There was an error processing the geocoding request. See Status or InnerException for more information."} System.Exception {Geocoding.Google.GoogleGeocodingException} Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} HResult -2146233088 int HelpLink null string InnerException null System.Exception Message "There was an error processing the geocoding request. See Status or InnerException for more information." string Source "Geocoding.Google" string StackTrace " at Geocoding.Google.GoogleGeocoder.<ProcessWebResponse>d__46.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Geocoding.Google.GoogleGeocoder.<ProcessRequest>d__39.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Geocoding.Google.GoogleGeocoder.<GeocodeAsync>d__34.MoveNext()" string Status Error Geocoding.Google.GoogleStatus

  •   TargetSite	{Void MoveNext()}	System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
    

ludydoo avatar Sep 28 '17 17:09 ludydoo

I get the same error. About every 10 requests but it varies.

seanpsherman avatar Nov 02 '17 14:11 seanpsherman

Mine was a over query limit, throttling it ~10s per request and adding a retry with a longer delay removed this, mostly. Apparently you can still get them regardless using the anonymous api.

seanpsherman avatar Nov 02 '17 16:11 seanpsherman

I encountered the same error. However, the InnerException was null which was helping not at all.

Getting an API Key solved the issue immediately. A snippet that might help:

var geoCoder = new Geocoding.Google.GoogleGeocoder();

geoCoder.ApiKey = "YourAPIKey";

var address =  geoCoder.Geocode( ... )

aatmmr avatar Feb 07 '18 18:02 aatmmr

@aatmmr I had the same error. thanks for the tips.

Geocoding.Google.GoogleGeocoder g = new Geocoding.Google.GoogleGeocoder(geocodingApiKey); //setting the apiKey in the constructor seems not to be enough g.ApiKey = geocodingApiKey;

alecava58 avatar Sep 25 '19 12:09 alecava58

I was getting the same issue and tried the suggestions above without success. I made the mistake of using the https string with the key. Using only the key worked.

JTRuark avatar Feb 17 '22 21:02 JTRuark