【发布时间】:2017-08-23 13:45:04
【问题描述】:
我最近将我的 asp.net 核心项目从 rc2 版本升级到 1.0.1。我无法弄清楚如何连接到 Azure 表存储。似乎有什么东西阻止了我的连接。
请注意,此代码在我的本地开发盒 Win10 15063 上运行。它不适用于我的开发服务器,运行 Win2012R2。它也适用于 .net core 预览版 1.0.0-preview2-003133,但不适用于 .net core 最终版 1.0.1
我正在使用最新的 Azure 存储包 8.1.1
这是我的代码
var azureTableStorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=blah_blahstoragedev;AccountKey=Blahblah;EndpointSuffix=core.windows.net"; //Configuration["AzureStorageConnectionString"];
storageAccount = CloudStorageAccount.Parse(connectionString);
tableClient = storageAccount.CreateCloudTableClient();
buildTable = tableClient.GetTableReference(BuildTableName);
buildTable.CreateIfNotExists();
因为这个异常而失败:
Microsoft.WindowsAzure.Storage.StorageException: '无法连接到远程服务器'
- InnerException {“无法建立连接,因为目标机器主动拒绝 127.0.0.1:8888”} System.Exception {System.Net.Sockets.SocketException}
堆栈跟踪“在 Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy 策略, OperationContext operationContext)
在 Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient 客户端,CloudTable 表,TableRequestOptions requestOptions, OperationContext operationContext)
在 Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(布尔值 primaryOnly, TableRequestOptions requestOptions, OperationContext 操作上下文)
在 Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)
【问题讨论】:
-
防火墙?存储模拟器是否在本地运行?
-
嘿,可能涉及防火墙,但肯定没有运行本地存储。但是我确实指定了连接字符串。他们应该连接到我的连接字符串所说的内容,对吧?
-
好吧,它说 127.0.0.1 拒绝连接,所以你做错了什么
标签: azure azure-storage azure-table-storage