azure.storage.blobs。身份验证错误编写元数据
我目前正在尝试从不推荐使用的Windowsazure.storage转换为azure.storage.blobs。转换的测试持续了几个小时,然后突然间,我在写信给元数据时开始遇到认证错误。斑点存储本身的读写本身可以正常工作。身份验证错误仅在写入元数据时才发生。
错误详细信息:
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:aff5570b-d01e-0000-2489-91c2ef000000
Time:2022-07-06T22:43:12.4693557Z
Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)
ErrorCode: AuthenticationFailed
Additional Information:
AuthenticationErrorDetail: The MAC signature found in the HTTP request 'yeIjNymEfC1YSyBNl1eTm8vpHHIcTMguAQRiaApU4xs=' is not the same as any computed signature. Server used following string to sign: 'PUT
x-ms-client-request-id:fbb1de4d-3163-4ba9-a73b-4434b0fdca4a
x-ms-date:Wed, 06 Jul 2022 22:43:12 GMT
x-ms-meta-testmetadata:Test Data
x-ms-return-client-request-id:true
x-ms-version:2021-06-08
/(My Storage Base)/testing-container/TestBlob.txt
comp:metadata'.
Content:
<?xml version="1.0" encoding="utf-8"?><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:aff5570b-d01e-0000-2489-91c2ef000000
Time:2022-07-06T22:43:12.4693557Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'yeIjNymEfC1YSyBNl1eTm8vpHHIcTMguAQRiaApU4xs=' is not the same as any computed signature. Server used following string to sign: 'PUT
x-ms-client-request-id:fbb1de4d-3163-4ba9-a73b-4434b0fdca4a
x-ms-date:Wed, 06 Jul 2022 22:43:12 GMT
x-ms-meta-testmetadata:Test Data
x-ms-return-client-request-id:true
x-ms-version:2021-06-08
/(My Storage Base)/testing-container/TestBlob.txt
comp:metadata'.</AuthenticationErrorDetail></Error>
Headers:
x-ms-request-id: aff5570b-d01e-0000-2489-91c2ef000000
x-ms-error-code: AuthenticationFailed
Content-Length: 823
Content-Type: application/xml
Date: Wed, 06 Jul 2022 22:43:12 GMT
Server: Microsoft-HTTPAPI/2.0
我的元数据属性代码:
public IDictionary<string, string> MetaData
{
get
{
IDictionary<string, string> Result = new Dictionary<string, string>();
Retry( () =>
{
var Props = BlobClient.GetProperties();
Result = Props.Value.Metadata;
} );
return Result;
}
set
{
Retry( () =>
{
BlobClient.SetMetadata( value );
} );
}
}
关于为什么仅在元数据上发生这种情况的任何想法。
I'm currently trying to convert from the deprecated WindowsAzure.Storage to Azure.Storage.Blobs. Testing of the conversion was going fine for a few hours then all of a sudden I started getting authentication errors when writing to the metadata. Reading and writing of the blob storage itself works OK. The authentication error only happens when writing to the metadata.
The error details:
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:aff5570b-d01e-0000-2489-91c2ef000000
Time:2022-07-06T22:43:12.4693557Z
Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)
ErrorCode: AuthenticationFailed
Additional Information:
AuthenticationErrorDetail: The MAC signature found in the HTTP request 'yeIjNymEfC1YSyBNl1eTm8vpHHIcTMguAQRiaApU4xs=' is not the same as any computed signature. Server used following string to sign: 'PUT
x-ms-client-request-id:fbb1de4d-3163-4ba9-a73b-4434b0fdca4a
x-ms-date:Wed, 06 Jul 2022 22:43:12 GMT
x-ms-meta-testmetadata:Test Data
x-ms-return-client-request-id:true
x-ms-version:2021-06-08
/(My Storage Base)/testing-container/TestBlob.txt
comp:metadata'.
Content:
<?xml version="1.0" encoding="utf-8"?><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:aff5570b-d01e-0000-2489-91c2ef000000
Time:2022-07-06T22:43:12.4693557Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'yeIjNymEfC1YSyBNl1eTm8vpHHIcTMguAQRiaApU4xs=' is not the same as any computed signature. Server used following string to sign: 'PUT
x-ms-client-request-id:fbb1de4d-3163-4ba9-a73b-4434b0fdca4a
x-ms-date:Wed, 06 Jul 2022 22:43:12 GMT
x-ms-meta-testmetadata:Test Data
x-ms-return-client-request-id:true
x-ms-version:2021-06-08
/(My Storage Base)/testing-container/TestBlob.txt
comp:metadata'.</AuthenticationErrorDetail></Error>
Headers:
x-ms-request-id: aff5570b-d01e-0000-2489-91c2ef000000
x-ms-error-code: AuthenticationFailed
Content-Length: 823
Content-Type: application/xml
Date: Wed, 06 Jul 2022 22:43:12 GMT
Server: Microsoft-HTTPAPI/2.0
My metadata property code:
public IDictionary<string, string> MetaData
{
get
{
IDictionary<string, string> Result = new Dictionary<string, string>();
Retry( () =>
{
var Props = BlobClient.GetProperties();
Result = Props.Value.Metadata;
} );
return Result;
}
set
{
Retry( () =>
{
BlobClient.SetMetadata( value );
} );
}
}
Any ideas as to why this only happens on the metadata appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了。这是因为元数据在文本的末尾有一条新线。看来元数据主体只能是单线文本。
I figured it out. It's because the metadata body had a new line at the end of the text. It appears the metadata body can only be single line text.