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
最後に、その他の注意事項: - Azure Blob Storage の CloudBerry Explorer でまったく同じアカウント データを使用しましたが、プロパティの値を確認できます。
私はネット上で他のサンプルを見てきました (これなど: http://blog.codingoutloud.com/2014/02/21/stupid-azure-trick-6-a-cors-toggler-command-line-tool- for-windows-azure-blob/ )も機能していないようです。
BLOB のコンテンツは、ブラウザーでパブリックにアクセスできます。
何か案は?また、このトピックに関する情報が不足していることにも困惑し、不満を感じています (残念ながら、Mono/RaspberryPi2 と REST API を使用して sb キューに書き込みを行っているときに、非常によく似た経験がありました)。