[英]How to find source of System.ExecutionEngineException Exception
[英]Reading Azure key vault throws exception: System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.'
我正在嘗試使用以下代碼從 Azure 密鑰庫中讀取值,但它總是第一次拋出異常,第二次運行正常。 因為它是System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.'
沒有辦法處理它(至少我知道)。
我的代碼如下所示:
private Dictionary<string, string> GetCredentials()
{
string tenantId = "<TenantId>";
string clientId = "<ClientId>";
string clientSecret = "<ClientSecret>";
string vaultUrl ="<VaultUrl>";
SecretClient secretClient = new SecretClient(
new Uri(vaultUrl),
new ClientSecretCredential(tenantId, clientId, clientSecret)
);
var UserName = secretClient.GetSecret("UserName");
var Password = secretClient.GetSecret("Password");
var result = new Dictionary<string, string>
{
{UserName.Value.Value, Password.Value.Value}
};
return result;
}
我們不能准確地說是在訪問 azure 密鑰保管庫時引發了此異常。 因為,當 CLR 出現問題時,會引發System.ExecutionEngineException
。 可能是之前發生的錯誤。 我看到的唯一解決方案是將代碼從起點重構到這一點(訪問密鑰庫的位置)。 你可以在這里深入了解這個問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.