【问题标题】:Dotnet Firebase Cloud Messaging blocked by firewall防火墙阻止了 Dotnet Firebase 云消息传递
【发布时间】:2020-04-17 11:43:01
【问题描述】:

我在本地环境中运行 .NET Core 工作器服务时遇到问题,默认情况下会阻止所有传出请求。该服务正在尝试通过 FirebaseAdmin 包 (https://github.com/Firebase/firebase-admin-dotnet) 发送推送通知,并且在我们托管在 azure 中的测试环境中,一切正常。

我不知道哪些 URL 需要在防火墙中打开,所以让通知继续。我收到的唯一错误消息没有帮助。

2020-04-17 12:42:19.979 +02:00 [ERR] Error sending notification 13f54141-0455-4829-afa0-172e7963965e
System.Net.Http.HttpRequestException: No such host is known.
 ---> System.Net.Sockets.SocketException (11001): No such host is known.
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Google.Apis.Http.ConfigurableMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.ExecuteAsync(TokenRequest request, HttpClient httpClient, String tokenServerUrl, CancellationToken taskCancellationToken, IClock clock)
   at Google.Apis.Auth.OAuth2.ServiceAccountCredential.RequestAccessTokenAsync(CancellationToken taskCancellationToken)
   at Google.Apis.Auth.OAuth2.TokenRefreshManager.RefreshTokenAsync()
   at Google.Apis.Auth.OAuth2.TokenRefreshManager.ResultWithUnwrappedExceptions[T](Task`1 task)
   at Google.Apis.Auth.OAuth2.TokenRefreshManager.<>c.<GetAccessTokenForRequestAsync>b__10_0(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Google.Apis.Auth.OAuth2.TokenRefreshManager.GetAccessTokenForRequestAsync(CancellationToken cancellationToken)
   at Google.Apis.Auth.OAuth2.ServiceAccountCredential.GetAccessTokenForRequestAsync(String authUri, CancellationToken cancellationToken)
   at Google.Apis.Auth.OAuth2.ServiceCredential.InterceptAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Google.Apis.Http.ConfigurableMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at FirebaseAdmin.Util.ErrorHandlingHttpClient`1.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at FirebaseAdmin.Util.ErrorHandlingHttpClient`1.SendAndReadAsync(HttpRequestMessage request, CancellationToken cancellationToken)

我查看了 google-api-dotnet 包,但似乎他们使用的是自己的日志系统,而我们的日志文件中没有显示。

任何人都知道如何获取有关此处阻止的主机的更多信息?

【问题讨论】:

    标签: asp.net-core .net-core firebase-admin google-api-dotnet-client


    【解决方案1】:

    你可能不得不敞开心扉:

    • accounts.google.com
    • oauth2.googleapis.com
    • fcm.googleapis.com

    【讨论】:

    • 即使打开了这些网址,它仍然无法正常工作:\
    • 您需要打开所有进出这些主机的流量。不只是将它们视为 URL。如果一切看起来都正确,请尝试通过github.com/googleapis/google-api-dotnet-client 报告问题
    猜你喜欢
    • 2022-07-27
    • 2017-02-08
    • 2019-04-07
    • 2014-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多