c# - Firebase:服务器响应不包含 JSON 对象
问题描述
我正在尝试运行 ASP.NET Core API 来发送 FCM 推送通知。
该 API 可与 Firebase SDK 配合使用。该代码基本上是文档中的代码:
初始化默认应用,configPath为JSON项目配置
FirebaseApp.Create(new AppOptions()
{
Credential = GoogleCredential.FromFile(configPath), //JSON con API Key credentials
});
我发送的有效负载示例
//Send a message to the device corresponding to the provided
//registration token.
//var message = new Message()
//{
// Data = new Dictionary<string, string>()
// {
// { "score", "850" },
// { "time", "2:45" },
// },
// Token = registrationToken,
// Notification = new Notification
// {
// Body = "Test"
// }
//};
我发送的异步任务
string response = await FirebaseMessaging.DefaultInstance.SendAsync(payload).ConfigureAwait(false);
在本地一切正常(正在发送推送通知),配置似乎没问题,但在我的服务器上运行的已部署 API 返回以下错误:
服务器在 Windows 10 上运行,具有 Internet 连接,并且已经有其他 API(与 FCM 无关)工作正常。
作为一个 ServiceUnavailable 错误,我已经检查了它是否是 Firebase 问题,但如果是 Firebase 问题,它在本地将无法工作,对吗?
解决方案
推荐阅读
- python - discord.py 中的条件命令
- linux - 如何在脚本中获取“复制为 cURL”?
- c++ - 为什么预减量会引起奇怪的变化?
- autohotkey - 为什么我的脚本在尝试打开和关闭键时不会运行?
- sql - 查找具有相同值的 ID 的计数
- r - ksvm 无法识别预测值
- python - 在 Pandas 中用 NaN 替换多个列中的多个字符串和数字
- google-app-engine - 数据存储错误:BadValueError:预期的整数,得到 [0, 1, 2, 3]
- python - 指针派生类型的 f2py f90wrap 错误
- javascript - 从 JSON javascript 准备 JSON 树结构