[英]System.MissingMethodException: Method not found for Bigquery
我正在使用 Google BigQuery 将数据从文件传输到 BigQuery。 我正在使用 BigQuery Google.Cloud.BigQuery.V2 version="1.3.0" 它是依赖 dll。 我的 C# 代码在 ConsoleApplication VS2019 中运行良好,但是当我使用 SSIS 任务时,出现错误:
System.MissingMethodException:找不到方法:'Google.Apis.Auth.OAuth2.GoogleCredential Google.Api.Gax.Rest.ScopedCredentialProvider.GetCredentials(Google.Apis.Auth.OAuth2)'.OAuth2 在 Google.Cloud.BigQuery.V2.BigQueryClient.Create(字符串 projectId,GoogleCredential 凭证)
var googlecredential = new GoogleCredentials()
{
private_key = "",
client_email = "",
type = ""
};
var credentials = GoogleCredential.FromJson(JsonConvert.SerializeObject(googlecredential));
BigQueryClient client = BigQueryClient.Create(projectId, credentials); -> this line throws error if I'm referencing dll Google.Cloud.BigQuery.V2 version 1.3 or 1.4 and it works if for 1.2 version.
注意:此错误仅发生在脚本任务中。 所有的 Dll 都在 GAC 中注册。
我有同样的问题。 最后我通过使用 BigqueryService 而不是 BigQueryClient 解决了这个问题。
var service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "CS Bigquery"
});
我使用的完整示例在这里: https://www.codeproject.com/Tips/785554/Google-BigQuery-API-Client-Sample-Code-for-Csharp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.