我们正在使用 azure key vault 进行 azure 存储 blob 加密。这是我为了让它工作而遵循的教程。
我开发了一个示例应用程序和一个用于加密 blob 的包装库。这一切都在示例应用程序中运行良好。但是在实际的软件中,当app请求token的时候,引用了wrapper项目之后就会出现异常,
private async Task<string> GetToken(string authority, string resource, string scope)
{
var authContext = new AuthenticationContext(authority);
ClientCredential clientCred = new ClientCredential(ADClientID, ADClientSecret);
AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);
if (result == null)
throw new InvalidOperationException("Failed to obtain the JWT token");
return result.AccessToken;
}
在上面的代码中
var authContext = new AuthenticationContext(authority);
它返回的异常是
InnerException = {"Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35."}
我究竟做错了什么?