C# Google Cloud Vision API-创建Grpc.Core.Channel时出错
我正在尝试使用Google Cloud Vision V1 Api的ImageAnnotatorClient类。我在下面的例子 创建(ServiceEndpoint、ImageAnnotatorSettings) 标题。我正在使用C#并试图构建一个经典的控制台应用程序。我使用的是Nuget的GRPC.Core版本1.15.0和Google.Cloud.Vision.V1版本1.2.0。我得到一个编译错误 “GoogleCredential”不包含的定义 “ToChannelCredentials”和无扩展方法“ToChannelCredentials” 无法找到接受类型为“GoogleCredential”的第一个参数 以下是我的代码:C# Google Cloud Vision API-创建Grpc.Core.Channel时出错,c#,google-cloud-platform,google-cloud-vision,google-client,C#,Google Cloud Platform,Google Cloud Vision,Google Client,我正在尝试使用Google Cloud Vision V1 Api的ImageAnnotatorClient类。我在下面的例子 创建(ServiceEndpoint、ImageAnnotatorSettings) 标题。我正在使用C#并试图构建一个经典的控制台应用程序。我使用的是Nuget的GRPC.Core版本1.15.0和Google.Cloud.Vision.V1版本1.2.0。我得到一个编译错误 “GoogleCredential”不包含的定义 “ToChannelCredentials
GoogleCredential credential = GoogleCredential
.FromFile(@"C:\Users\...\12345.json")
.CreateScoped(ImageAnnotatorClient.DefaultScopes);
Google.Cloud.Vision.V1.Image image1 = Google.Cloud.Vision.V1.Image.FromFile(@"c:\Users\....\Image14b.png");
Channel channel = new Channel(
ImageAnnotatorClient.DefaultEndpoint.Host, ImageAnnotatorClient.DefaultEndpoint.Port, credential.ToChannelCredentials());
ImageAnnotatorClient client = ImageAnnotatorClient.Create(channel);
IReadOnlyList<EntityAnnotation> textAnnotations = client.DetectText(image1);
有什么提示吗?您可能缺少一条使用指令,特别是
using Grpc.Auth;
请参见ToChannelCredentials
的定义作为扩展方法
检查您是否也包含了示例中存在的所有其他
使用指令。您可能缺少其中一个使用指令,特别是
using Grpc.Auth;
请参见ToChannelCredentials
的定义作为扩展方法
使用示例中的
指令检查是否包含了所有其他