未指定钱包文件必须通过/ wallet / <文件名> uri-path请求钱包RPC C#中使用BitcoinLib备份钱包时出错

问题描述

我目前正在开发一个小程序来备份您的Bitcoin Core钱包。我正在C#中使用BitcoinLib v1.15.0。

IBitcoinService bitcoinService = new BitcoinService("http://127.0.0.1:8332","test","",60);
bitcoinService.BackupWallet("C:\\Users\\dominik\\OneDrive\\Desktop\\backup");

运行此代码时,出现以下错误消息Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path)。 我有点困惑,因为BitcoinService.backupwallet(string destination)函数只有一个输入参数,我认为它描述了生成备份文件的路径(或者至少是该命令在Bitcoin Core终端中的工作方式)。>

有人在BitcoinBitb或类似问题上有经验吗?我愿意接受任何建议。 该错误与比特币核心中同时打开多个钱包有关。

解决方法

在我将 /wallet/<wallet_name> 添加到 RPC URL 后它起作用了

,

这只是现阶段的猜测,但您尚未在此路径“C:\Users\dominik\OneDrive\Desktop\backup”中指定文件扩展名,因此它不知道要查找的确切文件。换句话说,文件名不正确,因为它缺少“.something”的扩展名。否则你的路径还有其他问题,因为它可能必须有 /wallet/ 然后是 uri 路径,但你的路径没有。请告诉我你的情况。

,

如果您愿意备份钱包:

  1. 确保您的比特币节点正常运行
  2. 检查使用的用户名和密码(Windows 上的配置文件位于 %APPDATA%\bitcoin\bitcoin.conf)
  3. 使用带斜杠而不是反斜杠的路径,即。 c:/users/username/backup/bitcoin/c:/users/username/backup/bitcoin/wallet_backup.dat../backup/wallet_backup.dat

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...