相关疑难解决方法(0)

Azure,存储2.0的共享访问签名上的访问被拒绝

我在获取共享访问签名以使用Storage 2.0时遇到问题.

我用的代码是:

if (blob.Exists())
{
    var expires = DateTime.UtcNow.AddMinutes(30);
    var sas = blob.GetSharedAccessSignature(new Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy
    {
        Permissions = Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Read,
        SharedAccessExpiryTime = expires
    });
    url = string.Concat(blob.Uri.AbsoluteUri, sas);
}
return url;
Run Code Online (Sandbox Code Playgroud)

但是如果我调试会话并将URL粘贴到浏览器中,我会收到错误:

<Error>
  <Code>AuthenticationFailed</Code>
  <Message>
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:c1a1dd2b-bf4a-4a6b-bab2-ab1cb9363d27 Time:2012-11-19T14:41:51.1254531Z
  </Message>
  <AuthenticationErrorDetail>
Signature did not match. String to sign used was r 2012-11-19T15:11:36Z /container/path/1356/pic.jpg 2012-02-12
  </AuthenticationErrorDetail>
</Error>
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

更新:生成的URL如下所示:https: //storageaccountname.blob.core.windows.net/container/path/1356/pic.jpg?sv = 2012-02-12&se = …

c# azure azure-storage-blobs

4
推荐指数
1
解决办法
3659
查看次数

SAS URL 不起作用

我正在尝试为 blob 存储容器创建 SAS URL。我尝试了多个存储帐户和多种创建 SAS 的方法,当我在浏览器中测试 SAS URL 时,所有这些方法都给出了以下结果:

<Error>
<Code>AuthenticationFailed</Code>
<Message>
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:d95bf34f-0001-0022-4430-b1a25b000000 Time:2016-05-18T18:12:30.5552096Z
</Message>
<AuthenticationErrorDetail>
Signature did not match. String to sign used was rl 2016-05-18T18:10:00Z 2016-05-19T18:10:00Z /blob/cloudappmanager/$root 2015-04-05
</AuthenticationErrorDetail>
</Error>
Run Code Online (Sandbox Code Playgroud)

我尝试了存储资源管理器(右键单击容器,获取 SAS,使用默认值单击确定): 在此处输入图片说明

我尝试了旧的存储资源管理器:

在此处输入图片说明

我试过 PowerShell:

PS C:\Users\virklba> $context = New-AzureStorageContext -StorageAccountName msuscoreaprod 
cmdlet New-AzureStorageContext at command pipeline position 1
Supply values for the following parameters:
(Type …
Run Code Online (Sandbox Code Playgroud)

azure azure-storage

4
推荐指数
1
解决办法
3077
查看次数

标签 统计

azure ×2

azure-storage ×1

azure-storage-blobs ×1

c# ×1