'Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). error when backuping wallet using BitcoinLib in C#

I'm currently working on a little program for backing up your Bitcoin Core wallet. I am using BitcoinLib v1.15.0 in C#.

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

When I run this code I get following error message Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). I am a bit confused, because the BitcoinService.backupwallet(string destination) function has only one input parameter which I assume describes the path where it should generate the backup file (or at least that's the way this command works in Bitcoin Core's terminal).

Is there anyone with experience with BitcoinLib or similar problem. I am open to any suggestions. The error is related to multiple wallets open at once in Bitcoin Core.



Solution 1:[1]

It worked after I've added /wallet/<wallet_name> to the RPC URL

Solution 2:[2]

This is just a guess at this stage but you have not specified the file extension in this path "C:\Users\dominik\OneDrive\Desktop\backup" so it does not know exactly which file to look for. In other words the filename is incorrect as it is missing the extension of ".something". Otherwise something else is wrong with your path because maybe it has to have /wallet/ then the uri path but your path does not have that. Please let me know how you go.

Solution 3:[3]

If you willing to backup a wallet:

  1. Make sure your bitcoin node up and running
  2. Check used username & password (config file on Windows placed at %APPDATA%\bitcoin\bitcoin.conf)
  3. Use a path with slashes instead of backslashes, ie. c:/users/username/backup/bitcoin/ or c:/users/username/backup/bitcoin/wallet_backup.dat or ../backup/wallet_backup.dat

Solution 4:[4]

For me the error was the bitcoin config file. Check the wallet name property wallet=<your_wallet_name> at bitcoin.conf is correct.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vassily
Solution 2 Soliman Soliman
Solution 3
Solution 4 liorko