2011-12-16 142 views
4

我尝试连接到天蓝色表存储并添加对象。它工作在本地主机上最棒的,但是我用我得到下面的异常+其内部异常的服务器上: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... 
+0

请分享您的服务配置。你传递的是服务器的信任而不是dev的存储凭证? – SliverNinja 2011-12-16 16:09:36

回答

15

这是一个有点很长一段时间,但请检查您的网站托管在服务器上的时钟。所有Azure存储REST调用的部分authentication header是当前的UTC。如果这与Azure服务器所说的UTC时间相差太远,则会出现该错误。

0

你必须改变角色的数据连接字符串设置。我非常确定要么您误认了存储帐户密钥,要么保留了默认连接字符串“UseDevelopmentStorage = true”

没有适用于Azure存储的防火墙规则,仅适用于访问帐户。如果你还没有这样做,你必须创建一个存储。我建议您在托管服务的相同数据中心创建存储,以避免流量费用。然后,只需使用该门户中提供的存储帐户和密钥即可。

enter image description here

一个典型的真实Azure存储帐户连接字符串会是这个样子:

DefaultEndpointsProtocol = https和帐户名= YOUR_ACCOUNT_NAME; AccountKey = YOUR_ACCOUNT_KEY_BE_IT_PRIMARY_OR_SECONDARY ==

+0

我已经有存储空间了。当我通过本地主机(我仍然访问在线存储)访问它时,它工作正常。当我尝试从我使用的服务器访问它时,我得到了异常,我显示 – Guy 2011-12-16 17:22:08

+0

我的连接字符串看起来像那样。也尝试使用或不使用https – Guy 2011-12-16 17:35:50

相关问题