CreateIfNotExistsAsync - 此请求无权执行此操作
CreateIfNotExistsAsync - This request is not authorized to perform this operation
我正在使用将图像放入 blob 存储的 Microsoft 示例客户端应用程序。
它可以在我的笔记本电脑上运行,但是当我将它放在我的 Azure VM Windows 服务中时,我收到以下错误:
ERROR: This request is not authorized to perform this operation. - at
Microsoft.Azure.Storage.Core.Executor.Executor.<ExecuteAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Storage.Blob.CloudBlobContainer.<CreateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Storage.Blob.CloudBlobContainer.<CreateIfNotExistsAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
两个 IP 地址(笔记本电脑和虚拟机)都已添加到防火墙设置中。
我对两者使用相同的访问密钥。第二把钥匙我也试过了
string containerName = ContainerPrefix + Guid.NewGuid();
CloudStorageAccount storageAccount = Common.CreateStorageAccountFromConnectionString();
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
try
{
BlobRequestOptions requestOptions = new BlobRequestOptions() { RetryPolicy = new NoRetry() };
await container.CreateIfNotExistsAsync(requestOptions, null);
}
catch (StorageException ex)
{
Console.WriteLine($"ERROR: {ex.Message} - {ex.StackTrace}");
Console.ReadLine();
throw;
}
想法?
吉娜
尝试允许访问:所有网络以消除 IP 地址问题的可能性。
我正在使用将图像放入 blob 存储的 Microsoft 示例客户端应用程序。
它可以在我的笔记本电脑上运行,但是当我将它放在我的 Azure VM Windows 服务中时,我收到以下错误:
ERROR: This request is not authorized to perform this operation. - at
Microsoft.Azure.Storage.Core.Executor.Executor.<ExecuteAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Storage.Blob.CloudBlobContainer.<CreateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Storage.Blob.CloudBlobContainer.<CreateIfNotExistsAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
两个 IP 地址(笔记本电脑和虚拟机)都已添加到防火墙设置中。
我对两者使用相同的访问密钥。第二把钥匙我也试过了
string containerName = ContainerPrefix + Guid.NewGuid();
CloudStorageAccount storageAccount = Common.CreateStorageAccountFromConnectionString();
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
try
{
BlobRequestOptions requestOptions = new BlobRequestOptions() { RetryPolicy = new NoRetry() };
await container.CreateIfNotExistsAsync(requestOptions, null);
}
catch (StorageException ex)
{
Console.WriteLine($"ERROR: {ex.Message} - {ex.StackTrace}");
Console.ReadLine();
throw;
}
想法?
吉娜
尝试允许访问:所有网络以消除 IP 地址问题的可能性。