我正在使用 firesharp 包将值从 c# 代码发布到 firebase 实时数据库。但是 SetTaskAsync 方法抛出错误,我遵循了在 youtube 教程/其他博客中提到的相同语法。
代码:
var notification = new AdminNotification { Id = "1234", message = "New Notification", isRead = "false", type ="0" };
IFirebaseConfig config = new FirebaseConfig
{
BasePath = "https://*******.firebaseio.com",
AuthSecret= "**FireBaseApiKey**",
};
IFirebaseClient client;
client = new FireSharp.FirebaseClient(config);
var response = await client.SetTaskAsync("Notifications/", notification);
例外是:
执行请求时发生错误。路径:通知/,方法:补丁。发送请求时出错。无法解析服务器名称或地址
堆栈跟踪:
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 FireSharp.FirebaseClient.d__b`1.MoveNext()
请帮忙!