0

我在使用 WindowsAzure.Storage API 访问 blob 存储和获取/设置 CORS 属性时遇到了一些问题。我的代码很简单,例如:

Uri uri = new Uri("https://eqspprdimgstorage.blob.core.windows.net");
StorageCredentials sc = new StorageCredentials("myaccountname", "myverylongstring");
CloudBlobClient cbc = new CloudBlobClient(uri, sc);
cbc.GetServiceProperties();

从控制台应用程序运行此程序时,我收到此异常:

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

查看 Fiddler,它提供了更多细节:

The MAC signature found in the HTTP request '(sharedkeyhere)' is not the same as any computed signature.
Server used following string to sign: 'GET











x-ms-client-request-id:67535105-1492-48c8-97b3-e82b891e3ba7
x-ms-date:Thu, 14 May 2015 23:19:35 GMT
x-ms-version:2014-02-14
/eqspprdimgstorage/
comp:properties
restype:service
timeout:90'.

请注意,空行在返回的消息中。另外,我没有使用任何类型的代理,也没有使用 REST,而是使用 .Net API。请求标头是:

GET https://eqspprdimgstorage.blob.core.windows.net/?comp=properties&restype=service&timeout=90 HTTP/1.1
User-Agent: WA-Storage/4.3.0 (.NET CLR 4.0.30319.34209; Win32NT 6.2.9200.0)
x-ms-version: 2014-02-14
x-ms-client-request-id: 67535105-1492-48c8-97b3-e82b891e3ba7
x-ms-date: Thu, 14 May 2015 23:19:35 GMT
Authorization: SharedKey eqspprdimgstorage:(sharedkeyhere)
Host: eqspprdimgstorage.blob.core.windows.net
Connection: Keep-Alive

最后,还有一些其他注意事项: - 我在 CloudBerry Explorer 中为 Azure Blob 存储使用了完全相同的帐户数据,我可以看到属性的值。

有任何想法吗?由于缺乏有关此主题的信息,我也有点难过和沮丧(不幸的是,在使用 Mono/RaspberryPi2 和 REST api 写入某人队列时有非常相似的经历)。

4

0 回答 0