访问windows azure帐户表时出错
我正在尝试从web应用程序连接到azure帐户存储,但收到以下错误:“Microsoft.WindowsAzure.storage.StorageException中出现类型为“Microsoft.WindowsAzure.storage.StorageException”的异常,但未在用户代码中处理 其他信息:无法解析远程名称:“xxx.table.core.windows.net” 我在我的配置中只给出了xxx作为accountname 我可以从控制台应用程序访问相同的代码 我正在使用下面的代码从azure存储帐户获取记录访问windows azure帐户表时出错,azure,azure-storage,Azure,Azure Storage,我正在尝试从web应用程序连接到azure帐户存储,但收到以下错误:“Microsoft.WindowsAzure.storage.StorageException中出现类型为“Microsoft.WindowsAzure.storage.StorageException”的异常,但未在用户代码中处理 其他信息:无法解析远程名称:“xxx.table.core.windows.net” 我在我的配置中只给出了xxx作为accountname 我可以从控制台应用程序访问相同的代码 我正在使用下面的
string connStr = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connStr);
CloudTableClient client = storageAccount.CreateCloudTableClient();
CloudTable table = client.GetTableReference("ErrorLogs");
TableQuery<ErrorLogs> query = new TableQuery<ErrorLogs>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "ERROR"));
string connStr=ConfigurationManager.ConnectionString[“ConnString”].ConnectionString;
CloudStorageAccount-storageAccount=CloudStorageAccount.Parse(connStr);
CloudTableClient=storageAccount.CreateCloudTableClient();
CloudTable=client.GetTableReference(“ErrorLogs”);
TableQuery query=new TableQuery()。其中(TableQuery.GenerateFilterCondition(“PartitionKey”,QueryComparisons.Equal,“ERROR”);
我只给web.config指定了服务器名,比如xxxx,但当tit尝试连接时,它会说xxx.table.core.windows.net
以下是完整的异常详细信息:
[WebException:无法解析远程名称:'xxx.table.core.windows.net']
System.Net.HttpWebRequest.GetResponse()+1732
System.Net.HttpWebRequest.GetResponse()+600
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand`1 cmd,IRetryPolicy策略,OperationContext OperationContext)+2463
[StorageException:无法解析远程名称:'xxx.table.core.windows.net']
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand1 cmd,IRetryPolicy策略,OperationContext OperationContext)+7418
Microsoft.WindowsAzure.Storage.Table.TableQuery
1.ExecuteQuerySegmentedInternal(TableContinuationToken令牌、CloudTableClient客户端、CloudTable表、TableRequestOptions请求选项、OperationContext操作上下文)+436
Microsoft.WindowsAzure.Storage.Table.c__显示类7.b_uu 6(IContinuationToken continuationToken)+141
Microsoft.WindowsAzure.Storage.Core.Util.d_u01.MoveNext()+123
System.Linq.d_u3a
1.MoveNext()+400
System.Collections.Generic.List1..ctor(IEnumerable
1 collection)+402
System.Linq.Enumerable.ToList(IEnumerable`1 source)+54Hmmm不确定这里发生了什么。我刚刚在VisualStudio上创建了一个测试MVC应用程序,没有任何问题。我是这样安排的 Web.config:
<appSettings>
<add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxxx" />
</appSettings>
我被同样的错误消息难住了,直到我找到了Azure存储队列问题的答案: 原来区域冗余存储(ZRS)帐户不支持表。
我创建了一个新的本地冗余存储(LRS)帐户,一切都很好 你能分享一下你的
连接字符串的样子吗?请用一些伪值替换帐户名/密钥。还要检查您是否正在尝试连接web应用程序中的开发存储帐户。上面是我在web应用程序甚至控制台应用程序中使用的连接字符串。从控制台应用程序,它正在工作,但不是从web应用程序。如果您在云中托管它,请尝试云配置而不是配置管理器。。这将用于在运行时更改值,并且u可以使用不同的值进行测试
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));