.net core 如何使用.NETCore访问Google云数据存储模拟器?

.net core 如何使用.NETCore访问Google云数据存储模拟器?,.net-core,google-cloud-datastore,gcloud,datastore-mode-emulator,.net Core,Google Cloud Datastore,Gcloud,Datastore Mode Emulator,我在.Net Core v3.1中有一个简单的控制台程序: static void Main(string[] args) { var db = new DatastoreDbBuilder { ProjectId = "simple-proj", EmulatorDetection = EmulatorDetection.EmulatorOnly }.Build(); var keyFactory = db

我在.Net Core v3.1中有一个简单的控制台程序:

static void Main(string[] args)
{
    var db = new DatastoreDbBuilder 
    {
        ProjectId = "simple-proj",
        EmulatorDetection = EmulatorDetection.EmulatorOnly
    }.Build();

    var keyFactory = db.CreateKeyFactory("Simple");
    using (var transaction = db.BeginTransaction())
    {
        transaction.Insert(new Entity { Key = keyFactory.CreateIncompleteKey(), ["Message"] = "Hello" });
        transaction.Commit();
    }
}
我正在使用Google.Cloud.Datastore.V1 v3.0.0库从我的C#代码访问数据存储。我启动了仿真器,并使用$(gcloud beta-emulators datastore env init)设置环境变量,如文档所示。我从emulator端点收到OK消息(http://localhost:8081)当我通过浏览器访问它时。一切似乎都井然有序

这是我在.Net控制台上获得的堆栈转储:

Unhandled exception. Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="failed to connect to all addresses")
   at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg)
   at Grpc.Core.Calls.BlockingUnaryCall[TRequest,TResponse](CallInvocationDetails`2 call, TRequest req)
   at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext`2 ctx)
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext`2 context, BlockingUnaryCallContinuation`2 continuation)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Google.Cloud.Datastore.V1.Datastore.DatastoreClient.BeginTransaction(BeginTransactionRequest request, CallOptions options)
   at Google.Api.Gax.Grpc.ApiCall.GrpcCallAdapter`2.CallSync(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCallRetryExtensions.<>c__DisplayClass1_0`2.<WithRetry>b__0(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCall`2.<>c__DisplayClass10_0.<WithCallSettingsOverlay>b__1(TRequest req, CallSettings cs)
   at Google.Api.Gax.Grpc.ApiCall`2.Sync(TRequest request, CallSettings perCallCallSettings)
   at Google.Cloud.Datastore.V1.DatastoreClientImpl.BeginTransaction(BeginTransactionRequest request, CallSettings callSettings)
   at Google.Cloud.Datastore.V1.DatastoreClient.BeginTransaction(String projectId, CallSettings callSettings)
   at Google.Cloud.Datastore.V1.DatastoreDbImpl.BeginTransaction(CallSettings callSettings)
   at simple.Simple.Main(String[] args) in /Users/wreid/git/leapsystems/research/console-reports/Simple.cs:line 20

我是否在代码或模拟器的设置中遗漏了一些明显的内容?

您是否仍在对此进行阻止?如果是这样,我来看看。@DazWilkin我从来没有让它按照医生建议的方式工作过。我最终使用了这个问题中描述的方法。。。文档混乱,链接中断。真不幸。可能有趣的是,emulator报告“检测到非HTTP/2连接”(即非gRPC)。你也收到了吗?.NET客户端建议(!)它正在使用gRPC(
gRPC.Core.RpcException
)。你在Google@dazwilkin上提交了一份bug报告吗?谢谢你提交。我曾考虑过向github repo提交一个API问题,但想看看我是否误解了什么。很高兴我不是唯一一个觉得缺少文档的人。你还在阻止这个吗?如果是这样,我来看看。@DazWilkin我从来没有让它按照医生建议的方式工作过。我最终使用了这个问题中描述的方法。。。文档混乱,链接中断。真不幸。可能有趣的是,emulator报告“检测到非HTTP/2连接”(即非gRPC)。你也收到了吗?.NET客户端建议(!)它正在使用gRPC(
gRPC.Core.RpcException
)。你在Google@dazwilkin上提交了一份bug报告吗?谢谢你提交。我曾考虑过向github repo提交一个API问题,但想看看我是否误解了什么。很高兴我不是唯一一个觉得缺少文档的人。
[datastore] Jul 24, 2020 5:48:42 PM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
[datastore] INFO: Adding handler(s) to newly registered Channel.
[datastore] Jul 24, 2020 5:48:42 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[datastore] INFO: Detected non-HTTP/2 connection.
[datastore] Jul 24, 2020 5:48:42 PM io.gapi.emulators.netty.NotFoundHandler handleRequest
[datastore] INFO: Unknown request URI: /bad-request