连接到自定义域上的 Azure Blob 存储

发布于 2025-01-16 06:02:25 字数 1448 浏览 3 评论 0原文

我在使用 HTTPS 从我们的自定义域上的此 Blob 存储下载文件时遇到问题。 如果我在自定义域上进行匿名访问,我可以通过浏览器下载它。 我可以使用此连接字符串通过名为 Azure.Storage.Blobs 的 Nuget 包下载它。

DefaultEndpointsProtocol=https;AccountName=websocketechoblobdev;AccountKey=xxxx;EndpointSuffix=core.windows.net

如果我尝试使用此连接字符串通过名为 Azure.Storage.Blobs 的 Nuget 包下载它。 DefaultEndpointsProtocol=https;AccountName=websocketechoblobdev;AccountKey=xxxx;BlobEndpoint=https://zzz.xxx.com

我收到此错误:

Response x-ms-client-request-id 'e0e7c66d-0629-43f3-85a7-79034ae77d03' does not match the original expected request id, 'e18050d9-6057-43fe-aaa0-5e41e9aa410c'.
Status: 200 (OK)

标头:

Content-MD5: /iAiKhL83XuGqgNErvqdpg==
X-Cache: REDACTED
x-ms-request-id: 89bbe80a-101e-002f-048f-3e59dc000000
x-ms-client-request-id: e0e7c66d-0629-43f3-85a7-79034ae77d03
x-ms-version: 2021-04-10
x-ms-creation-time: Mon, 14 Mar 2022 12:29:32 GMT
x-ms-lease-status: unlocked
x-ms-lease-state: available
x-ms-blob-type: BlockBlob
x-ms-server-encrypted: true
X-Azure-Ref-OriginShield: REDACTED
X-Azure-Ref: REDACTED
Accept-Ranges: bytes
Content-Length: 3459
Content-Type: application/x-pkcs12
Date: Wed, 23 Mar 2022 10:28:19 GMT
ETag: '0x8DA05B64AED6E28'
Last-Modified: Mon, 14 Mar 2022 12:29:32 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0

我发现它在第一次下载文件时有效但之后它会失败并出现上述异常,重新启动程序也无济于事。 这与它是 HTTPS 有关,如果我将其设置为 HTTP,它就可以工作。

谢谢

I have problem downloading files from this blob storage on our custom domain with HTTPS.
I can download it through the browser if I make anonymous access on the custom domain.
I can download it through the Nuget package called Azure.Storage.Blobs with this connection string.

DefaultEndpointsProtocol=https;AccountName=websocketechoblobdev;AccountKey=xxxx;EndpointSuffix=core.windows.net

If I try to download it through the Nuget package called Azure.Storage.Blobs with this connection string.
DefaultEndpointsProtocol=https;AccountName=websocketechoblobdev;AccountKey=xxxx;BlobEndpoint=https://zzz.xxx.com

I get this error:

Response x-ms-client-request-id 'e0e7c66d-0629-43f3-85a7-79034ae77d03' does not match the original expected request id, 'e18050d9-6057-43fe-aaa0-5e41e9aa410c'.
Status: 200 (OK)

Headers:

Content-MD5: /iAiKhL83XuGqgNErvqdpg==
X-Cache: REDACTED
x-ms-request-id: 89bbe80a-101e-002f-048f-3e59dc000000
x-ms-client-request-id: e0e7c66d-0629-43f3-85a7-79034ae77d03
x-ms-version: 2021-04-10
x-ms-creation-time: Mon, 14 Mar 2022 12:29:32 GMT
x-ms-lease-status: unlocked
x-ms-lease-state: available
x-ms-blob-type: BlockBlob
x-ms-server-encrypted: true
X-Azure-Ref-OriginShield: REDACTED
X-Azure-Ref: REDACTED
Accept-Ranges: bytes
Content-Length: 3459
Content-Type: application/x-pkcs12
Date: Wed, 23 Mar 2022 10:28:19 GMT
ETag: '0x8DA05B64AED6E28'
Last-Modified: Mon, 14 Mar 2022 12:29:32 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0

I found out that it works the first time I download the file but it fails with the exception above after that, it doesn't help to restart the program.
It has something to do with it being HTTPS, if I set it up to HTTP it works.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抹茶夏天i‖ 2025-01-23 06:02:27

• 请检查第二个连接字符串中为用于 Blob 存储的自定义域链接创建的 CNAME 记录,因为它应指向您的 Blob 存储端点的主机名。因此,创建将访问请求重定向到 Blob 存储终结点所需的适当 DNS 记录将确保通信成功、经过验证且可信。

有关上述内容以将自定义域正确映射到 Azure Blob 存储的更多信息,请参阅下面的文档链接: -

https://learn.microsoft.com/en-us/azure/storage/blobs/storage-custom-domain-name?tabs=azure-portal#map-a-custom-domain-with-zero-downtime

• 其次,会要求您在尝试访问 Azure Blob 存储的浏览器中“清空缓存并硬刷新”。此外,即使您可能尝试使用连接字符串通过程序代码从 Blob 存储下载文件,请确保代码编辑器已清除所有缓存和临时文件,然后下载 blob 存储中的文件。这可能会消除在离开“Azure.Storage.Blobs”SDK 之前更改“x-ms-client-request-id”标头属性的问题。

• 最后,请注意,Azure 存储任何组件的自定义域名仅适用于 HTTP,不适用于 HTTPS,而为 Azure blob 容器启用匿名访问要下载的文件可以公开访问,因为它们仅支持自定义域名访问。

• Kindly please check the CNAME records created for the custom domain link used for blob storage in the second connection string as it should point to the hostname of your blob storage endpoint. Thus, creating the appropriate DNS records required for redirecting the access requests to the blob storage endpoint will ensure that the communication is successful, validated, and authentic.

For more information on the above to map the custom domain correctly to the Azure blob storage, please refer to the documentation link below: -

https://learn.microsoft.com/en-us/azure/storage/blobs/storage-custom-domain-name?tabs=azure-portal#map-a-custom-domain-with-zero-downtime

• Secondly, would request you to please ‘Empty the cache and hard refresh’ the browser from where you are trying to access the Azure blob storage. Also, even though you might be trying to download the files from the blob storage through a program code using the connection string, please ensure that the code editor has been cleared of all the cache and temporary files and then the files from the blob storage are downloaded. This might negate the issue of the ‘x-ms-client-request-id’ header attribute being altered before leaving the ‘Azure.Storage.Blobs’ SDK.

• Finally, please take note that the custom domain name for any component of Azure storage only works for HTTP and not for HTTPS while the anonymous access enabled for the Azure blob containers from which files are to be downloaded are made publicly accessible as they are only supported for custom domain name access.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文