WindowsAzure.Storage 4.3.0.0调用CloudBlobClient.GetServiceProperties()时的身份验证错误

时间:2015-05-14 23:55:27

标签: c# azure storage blobs

使用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编写sb队列时有非常相似的经历,不幸的是)。

0 个答案:

没有答案