首页 > 解决方案 > grpc中的.net Google.Cloud.Firestore名称解析错误

问题描述

我的后端在尝试访问云 Firestore 集合时失败。我使用 nuget 包 Google.Cloud.Firestore(当前为 1.0.0-beta20)。错误说

Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Name resolution failure")

我的代码是

public async Task PushAppointment(CcAppointment appointment)
{
    var fireStoreDb = await FirestoreDb.CreateAsync("peakplan-fb-mobile"); 

    var docRef = fireStoreDb.Collection("appointments");  
    await docRef.AddAsync(appointment);
}

Google Credentials JSON env var 已正确设置和加载。

我在异常消息之前得到这些日志:

D0530 02:26:56.253562 Grpc.Core.Internal.UnmanagedLibrary Attempting to load native library "/Users/gabrielwahle/.nuget/packages/grpc.core/1.19.0/lib/netstandard1.5/../../runtimes/osx/native/libgrpc_csharp_ext.x64.dylib"
D0530 02:26:56.347160 Grpc.Core.Internal.NativeExtension gRPC native library loaded successfully.

使用这些日志设置:

Environment.SetEnvironmentVariable("GRPC_TRACE", "api,cares_resolver,cares_address_sorting");
Environment.SetEnvironmentVariable("GRPC_VERBOSITY", "debug");

有没有人处理过这个错误?

标签: .netdnsgoogle-cloud-firestoregrpc

解决方案


推荐阅读