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

C# 调用CloudBlobClient.GetServiceProperties()时WindowsAzure.Storage 4.3.0.0身份验证错误,c#,azure,storage,blobs,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

我在使用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,而是使用.NETAPI。请求头包括:

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 for Azure Blob存储中使用了相同的帐户数据,我可以看到属性的值

  • 我在网上看到过其他的样本(比如这个:),它们似乎也不起作用

  • blob的内容可以在浏览器中公开访问:


有什么想法吗?我还对缺乏关于这个主题的信息感到困惑和沮丧(不幸的是,在使用Mono/RaspberryPi2和REST api编写sb队列时有过非常相似的经历)。

我尝试了相同的代码,它对我来说非常好。请检查两件事:1)帐户密钥是否正确,2)计算机上的时钟是否正确。这是两个最常见的错误原因。你好,高拉夫。我使用CloudBerry尝试了相同的凭据,我可以毫无问题地访问blob存储(例如,包括添加图像)。至于时钟:在Windows 8.1上,我在正确的时区(里斯本),我的时间与time.Windows.com进行互联网同步。还有其他想法吗?你试过4.3版本的API吗?那太奇怪了。是的,我用的是4.3版本。您是否尝试过使用以下内容创建CloudBlobClient实例:
var account=new CloudStorageAccount(sc,true);var cbc=account.CreateCloudBlobClient()