c# - Azure Blob 存储 - 服务器无法对请求进行身份验证

标签 c# azure

出现以下错误:

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

我正在使用WindowsAzure.Storage包来获取blob流,非常简单。

 _blobClient = CloudStorageAccount
                .Parse(options.ConnectionString)
                .CreateCloudBlobClient();

  var blob = _blobClient.GetContainerReference(containerName)
                .GetBlobReference(blobName);

var file = await blob.OpenReadAsync(null, _requestOptions,
_context).ConfigureAwait(false);

我尝试使用帐户 key 和名称以及连接字符串,结果是相同的。

使用Azure存储资源管理器也会发生同样的情况,我无法将任何文件上传到存储。 (只是继续上传,进度为 0%)。仅当我直接连接到我的 Microsoft 帐户时才有效。

enter image description here

  • 我的计算机时间和时区是自动设置的。
  • 存储区域为东南亚、东亚

是否需要进行任何额外配置?

谢谢

最佳答案

我在 Android 模拟器中运行代码,其中时区与主机不同。需要设置设备级别的时区,以便 header 签名正确发送到 Azure API。

这解决了问题。

关于c# - Azure Blob 存储 - 服务器无法对请求进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46936817/

相关文章:

c# - 修复字符串编码问题

reactjs - 剧作家:如何将环境变量从库传递到管道?

azure - 使用 Azure AD 作为 SAP HANA 中的 IDP 进行 SAML 单点注销

azure - 如何在 Azure SQL PaaS 中进行复制

C 库的 C# 包装器类

C# 指定的填充模式对此算法无效

C# LINQ 用有意义的字符串替换空值

c# - 添加到服务提供者后能否更改Msal Authentication中的Authority、ClientId、DefaultAccessTokenScopes

node.js - 运行 Express JS 的 Azure 应用服务中的 CORS header

c# - Elmah.Mvc 错误日志存储在哪里?如何将它们存储在 azure SQL 数据库中?