Windows Azure Queue返回403 Forbidden

Kor*_*ijn 3 message-queue azure

使用以下代码(我已经模糊了实际的凭据):

CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(new StorageCredentials(username, key), true);
CloudQueueClient clnt = cloudStorageAccount.CreateCloudQueueClient();

string logQueueReference = "log2";
CloudQueue queue = clnt.GetQueueReference(logQueueReference);

queue.CreateIfNotExists();
Run Code Online (Sandbox Code Playgroud)

生成以下请求:

HEAD /log2?comp=metadata&timeout=90 HTTP/1.1
x-ms-version: 2012-02-12
User-Agent: WA-Storage/2.0.6.0
x-ms-date: Tue, 29 Apr 2014 13:26:29 GMT
Authorization: SharedKey username:transformedkey
Host: username.queue.core.windows.net
Run Code Online (Sandbox Code Playgroud)

并返回以下响应:

HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 0cc84a81-73e1-4a8c-bf16-098af2b21149
Date: Tue, 29 Apr 2014 15:26:29 GMT
Run Code Online (Sandbox Code Playgroud)

我双重检查了凭证.它们是从manage.windowsazure.com的对话框中复制粘贴的.我在这里错过了什么?

Gau*_*tri 8

虽然这个403错误的最常见原因是错误的帐户密钥(所以我会请求您再次检查)但是如果计算机上的时钟关闭(也称为clock skewness),也可能出现此错误.请检查计算机上的时钟并确保它不会过多.有关更多详细信息,请参阅此主题:从WindowsAzure.Storage生成403错误.