1

What am trying is to fetch the locations using google coordinate api. The code snippet I used is as follows,

            String serviceAccountEmail = "mail.gserviceaccount.com";

            var certificate = new X509Certificate2(Server.MapPath("../CertStore/cert.p12"), "notasecret", X509KeyStorageFlags.Exportable);

            ServiceAccountCredential credential = new ServiceAccountCredential(
               new ServiceAccountCredential.Initializer(serviceAccountEmail)
               {
                   Scopes = new[] { CoordinateService.Scope.Coordinate }
               }.FromCertificate(certificate));

            // Create the service.
            var service = new CoordinateService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "sample",
            });
            var list = service.Location.List("teamId", "workermail", 1000).Execute();

But am getting an exception as follows,

A first chance exception of type 'Google.GoogleApiException' occurred in Google.Apis.dll A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Google.Apis.dll Evaluation requires a thread to run temporarily. Use the Watch window to perform the evaluation.

stack trace

Source Error:

Line 395: ApplicationName = "sample",

Line 396: });

Line 397: var list = service.Location.List("teamId", "workermail", 1000).Execute();

Line 398:
Line 399:

stack trace is Am doing anything wrong here?..

Thanks,

Anish.

Anish Karunakaran
  • 987
  • 3
  • 17
  • 39
  • 1
    Can you attach the full stacktrace? What is the exact code (line) that throws the exception? – peleyal Oct 29 '14 at 19:52
  • 1
    ASP.NET uses `ThreadAbortException` to end a response so this exception is not an indication of an error. Most likely the Google API code is performing a redirect. What happens if you remove your suspicious catch/throw code? Do your code then perform as expected? – Martin Liversage Oct 30 '14 at 06:00
  • No. I just removed that try catch to get the above stack trace. – Anish Karunakaran Oct 30 '14 at 06:14

0 Answers0