BigQuery错误GoogleCredential C#

时间:2016-10-17 19:08:54

标签: c# .net visual-studio google-bigquery google-cloud-platform

使用Google在github上提供的代码我正在测试使用C#将文件上传到bigquery,其中一项测试显示自己的Google代码中存在错误。

GoogleCredential credential =
GoogleCredential.GetApplicationDefaultAsync().Result;

出现此错误“System.AggregateException”

课程完成

static public BigqueryService CreateAuthorizedClient()
    {
        GoogleCredential credential =
            GoogleCredential.GetApplicationDefaultAsync().Result;
        // Inject the Bigquery scope if required.
        if (credential.IsCreateScopedRequired)
        {
            credential = credential.CreateScoped(new[]
            {
                BigqueryService.Scope.Bigquery
            });
        }
        return new BigqueryService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = "DotNet Bigquery Samples",
        });
}

有人可以帮我解决这个问题。

感谢。

1 个答案:

答案 0 :(得分:0)

我通常会在您未正确验证时看到此信息。尝试运行" gcloud beta auth application-default login"首先在运行该代码之前。