仅当部署在服务器上而非本地主机上时出现 Azure 异常
我尝试连接到天蓝色表存储并添加一个对象。它在本地主机上工作得很好,但是在我使用的服务器上我得到以下异常+其内部异常:
Exception of type 'Microsoft.WindowsAzure.StorageClient.StorageClientException' was thrown.
System.Data.Services.Client.DataServiceQueryException: An error occurred while processing this request.
---> System.Data.Services.Client.DataServiceClientException:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>AuthenticationFailed</code>
<message xml:lang="en-US">Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:17..127 Time:2011-12-16T15:47:50.7505473Z</message>
</error>
at System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)
at System.Data.Services.Client.QueryResult.EndExecute[TElement](Object source, IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.CloudTableClient.GetResultOrDefault[T](Task`1 task, T& result)
我的连接字符串:
DefaultEndpointsProtocol=http;AccountName=nameoftable;AccountKey=accountkey...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有点遥远,但请检查托管您网站的服务器上的时钟。所有 Azure 存储 REST 调用的身份验证标头的一部分是当前世界标准时间。如果这与 Azure 服务器所说的 UTC 时间相差太远,您将收到该错误。
This is a bit of a long shot, but check the clock on the server your site is being hosted on. Part of the authentication header for all Azure storage REST calls is the current UTC. If this is too far out from what the Azure servers say is the UTC time you'll get that error.
您必须在角色的设置中更改数据连接字符串。我非常确定您要么弄错了存储帐户密钥,要么保留了默认连接字符串“UseDevelopmentStorage=true”。
没有适用于 Azure 存储的防火墙规则,只有访问帐户。如果您尚未创建存储,则必须创建该存储。我建议您在与托管服务相同的数据中心中创建存储,以避免产生流量费用。然后只需使用门户中提供的存储帐户和密钥即可。
典型的真实 Azure 存储帐户连接字符串如下所示:
DefaultEndpointsProtocol=https;AccountName =YOUR_ACCOUNT_NAME;AccountKey=YOUR_ACCOUNT_KEY_BE_IT_PRIMARY_OR_SECONDARY==
You have to change your data connection string in Role's Settings. I am pretty much sure that either you have mistaken the storage account key, or you left the default connection string "UseDevelopmentStorage=true"
There are no firewall rules that apply to Azure storage, just the account for access. You must create a storage, if you haven't done that already. I suggest that you create your storage in the same data center as your hosted service to avoid traffic charges. Then just use that storage account and key provided in the portal.
A typical real azure storage account connection string would look something like this:
DefaultEndpointsProtocol=https;AccountName=YOUR_ACCOUNT_NAME;AccountKey=YOUR_ACCOUNT_KEY_BE_IT_PRIMARY_OR_SECONDARY==