视窗 10 x64
Vault 在我计算机上的 docker 容器中工作。我可以通过容器控制台成功获取我的秘密:
但是当我尝试通过 C# 代码(VaultSharp,.Net Framework 4.8)执行相同操作时出现异常:
try
{
IAuthMethodInfo authMethod = new TokenAuthMethodInfo("myroot");
var vaultClientSettings = new VaultClientSettings(
"http://localhost:8200", authMethod);
IVaultClient vaultClient = new VaultClient(vaultClientSettings);
Secret<SecretData> kv2Secret = await vaultClient.V1.Secrets.KeyValue.V2
.ReadSecretAsync(path: "secret/dev/crm", mountPoint: "kv");
}
catch (Exception ex)
{
throw ex; // ERROR: {"errors":["no handler for route 'kv/data/secret/dev/crm'"]}
}
为什么我得到它,我该如何解决这个问题?