【发布时间】:2017-05-10 20:43:24
【问题描述】:
我正在使用 C# 进行 ADLS 身份验证,并且想要执行一些文件操作,例如删除、重命名。使用以下代码进行身份验证和删除操作
var context = new AuthenticationContext("https://login.windows.net/" + tenantId);
ClientCredential clientCredential = new ClientCredential(appId, secretKey);
var tokenResponse = context.AcquireTokenAsync("https://management.azure.com/", clientCredential).Result;
var accessToken = tokenResponse.AccessToken;
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
client.BaseAddress = new Uri("https://management.azure.com/");
}
ServiceClientCredentials creds = new TokenCredentials(tokenResponse.AccessToken);// tokenResponse.IdToken, tokenResponse.AccessTokenType);
DataLakeStoreFileSystemManagementClient _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds);
_adlsFileSystemClient.FileSystem.Delete(_adlsAccountName, FilenameWPath);
我收到 AdlsError,
未处理的类型异常 'Microsoft.Azure.Management.DataLake.Store.Models.AdlsErrorException' 发生在 ConsoleApplication1.exe 中
这意味着应该启用 WebHDFS?如何在 ADLS 上启用 webHDFS。我检查了 HDInight,webHDFS 已启用。
请告诉我,我该如何解决这个问题。
【问题讨论】:
标签: c# azure azure-storage azure-api-apps