简体   繁体   English

为什么要通过Google Cloud Firestore 1.0.0-beta05 C#SetAsync获取Grpc.Core.RpcException StatusCode =不可用,Detail =“连接失败”?

[英]Why getting Grpc.Core.RpcException StatusCode=Unavailable, Detail=“Connect Failed”, with Google Cloud Firestore 1.0.0-beta05 C# SetAsync?

We are using C# with the Google.Cloud.Firestore.1.0.0-beta05 NuGet package, and we always get a Grpc.Core.RpcException when we try to call SetAsync. 我们正在将C#与Google.Cloud.Firestore.1.0.0-beta05 NuGet包一起使用,并且在尝试调用SetAsync时始终会收到Grpc.Core.RpcException。

Details: 细节:

  1. Visual Studio 2017 Visual Studio 2017
  2. .NET Framework V4.6.2 .NET Framework V4.6.2
  3. ASP.NET ASP.NET
  4. Version: Google.Cloud.Firestore.1.0.0-beta05 版本:Google.Cloud.Firestore.1.0.0-beta05
  5. Date Published: Thursday, June 07, 2018 (6/7/2018) 发行日期:2018年6月7日星期四(6/7/2018)
  6. Environment Variable GOOGLE_APPLICATION_CREDENTIALS has been set. 环境变量GOOGLE_APPLICATION_CREDENTIALS已设置。
  7. Proxy configured in web.config per our Company setup. 根据我们公司的设置在web.config中配置的代理。
  8. Environment variables http_proxy and https_proxy have been set. 已设置环境变量http_proxy和https_proxy。

Can anyone help us understand why we get the following? 谁能帮助我们理解为什么我们得到以下内容?

Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Connect Failed") Grpc.Core.RpcException:状态(状态代码=不可用,详细信息=“连接失败”)

The relevant snippets follow. 相关片段如下。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Regards, 问候,

Eamonn 埃蒙·

C# Method: C#方法:

private async Task FirebaseSetAsync(string projectId)
{
    var database = FirestoreDb.Create(projectId: projectId);

    var docRef = database.Collection("users").Document("company");

    Dictionary<string, object> user = new Dictionary<string, object>
    {
        { "First", "Alan" },
        { "Middle", "Mathison" },
        { "Last", "Turing" },
        { "Born", 1912 }
    };

    try
    {
        var result = await docRef.SetAsync(user);
    }
    catch (Exception exception)
    {
        Log.Error("Exception.", exception);
    }
}

web.config snippet: web.config代码段:

<system.net>
  <defaultProxy>
    <proxy proxyaddress="http://w.x.y.z:pppp/" />  
  </defaultProxy>
</system.net>

Log file snippet: 日志文件片段:

20:15:26.938 [   7] [(null)] ERROR FirebaseFive.Controllers.HomeController - Exception.
Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Connect Failed")
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Google.Api.Gax.Grpc.ApiCallRetryExtensions.<>c__DisplayClass0_0`2.<<WithRetry>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Cloud.Firestore.WriteBatch.<CommitAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Cloud.Firestore.DocumentReference.<SetAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at FirebaseFive.Controllers.HomeController.<FirebaseSetAsync>d__1.MoveNext() in         

D:\\Projects\\Git\\Firebase\\FirebaseFive\\FirebaseFive\\Controllers\\HomeController.cs:line 33 D:\\ Projects \\ Git \\ Firebase \\ FirebaseFive \\ FirebaseFive \\ Controllers \\ HomeController.cs:第33行

With grateful assistance from some people at Google, the answer is as follows: 在Google某些人员的帮助下,答案如下:

The Firestore library/SDK communicates using the HTTP/2.0 Protocol and our Company Proxy (squid-cache) does not support HTTP/2.0. Firestore库/ SDK使用HTTP / 2.0协议进行通信,而我们的公司代理(squid-cache) 支持HTTP / 2.0。

Now we have to see if we can get a list of IP Addresses for the Firestore and associated services/domains so that we can bypass the Proxy for those Addresses. 现在,我们必须查看是否可以获取Firestore和相关服务/域的IP地址列表,以便我们可以绕过这些地址的代理。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Grpc.Core.RpcException:'状态(状态代码=“不可用”,详细信息=“空更新”, - Grpc.Core.RpcException: 'Status(StatusCode=“Unavailable”, Detail=“Empty update”, Grpc.Core.RpcException: 'Status (StatusCode = "Unavailable", Detail = "Error starting gRPC call - Grpc.Core.RpcException: 'Status (StatusCode = "Unavailable", Detail = "Error starting gRPC call Grpc.Core.RpcException StatusCode Unavailable Channel 处于状态 TRANSIENT_FAILURE - Grpc.Core.RpcException StatusCode Unavailable Channel is in state TRANSIENT_FAILURE Google Vision API无法正常运行Grpc.Core.RpcException - Google Vision API not working Grpc.Core.RpcException Grpc.Core.RpcException 方法未在 C# 客户端和 Java 服务器中实现 - Grpc.Core.RpcException method is unimplemented with C# client and Java Server 从ASP.NET在本地访问Google Cloud Datastore会引发Grpc.Core.RpcException:“缺少权限或权限不足。” - Accessing Google Cloud Datastore locally from ASP.NET throws Grpc.Core.RpcException: “Missing or insufficient permissions.” Grpc.Core.RpcException“无法反序列化响应消息..”或“InvalidOperationException:长度不匹配” - Grpc.Core.RpcException "Failed to deserialize response message.." or "InvalidOperationException: Length mismatch" C# 程序将数据保存到 Google FirestoreDB 在某些计算机上失败(状态代码=不可用;grpc_status:14) - C# Program saving data to Google FirestoreDB fails on some computers (StatusCode=Unavailable; grpc_status: 14) 从 .NET MAUI 应用程序调用 gRPC 服务时出现 Grpc.Core.RpcException - Grpc.Core.RpcException when calling gRPC service from .NET MAUI app 来自 C# gRPC-server 的 RpcException 中的空元数据 - Empty metadata in RpcException from C# gRPC-server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM