【问题标题】:unable to connect to local Azure storage account无法连接到本地 Azure 存储帐户
【发布时间】:2019-06-08 03:03:07
【问题描述】:

我已经在本地机器上初始化了一个 Azure 存储模拟器,但我无法从 Visual Studio 或 Azure 存储资源管理器连接到它。我错过了什么?

尝试连接到本地 Azure 存储帐户模拟器时出错:

Unable to retrieve child resources.
A network error occurred (NetworkTimeoutError: connect ECONNREFUSED 127.0.0.1:10002)

如果我尝试探索存储,Visual Studio Server Explorer 中的错误=>开发:

  Cannot create database 'AzureStorageEmulatorDb59' : The database 'AzureStorageEmulatorDb59' does not exist. Supply a valid database name. To see available databases, use sys.databases..
    Learn more about known storage blob issues and solutions at https://go.microsoft.com/fwlink/?LinkId=532762.

在我的机器上初始化 Azure 存储模拟器的命令。

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate
Windows Azure Storage Emulator 5.9.0.0 command line tool
Attempting to use server specified.
User specified an instance through /server or /sqlInstance options.
Probing SQL Instance: '.\SQLEXPRESS'.
Found SQL Instance .\SQLEXPRESS.
Creating database AzureStorageEmulatorDb59 on SQL instance '.\SQLEXPRESS'.

Granting database access to user DESKTOP-2LS7578\AjitGoel.
Database access for user DESKTOP-2LS7578\AjitGoel was granted.

Initialization successful. The storage emulator is now ready for use.
The storage emulator was successfully initialized and is ready to use.

更新: 我试过了 一种。添加与 C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\storageemulatorexplorer.exe.config 中提供的名称相同的名称 湾。在 Internet Explorer 中将 http://127.0.0.1 添加到本地互联网区域, C。删除 %AppData%\Roaming\StorageExplorer 中的文件 但以上选项都没有帮助。

Azure 存储资源管理器屏幕截图

【问题讨论】:

  • 您在存储资源管理器中看到本地存储帐户了吗?
  • @Jayendran,我已经添加了问题的更新。我可以看到本地存储帐户,但无法连接。

标签: azure azure-storage azure-table-storage azure-storage-emulator


【解决方案1】:

首先,关于 Azure Storage Emulator 的使用都在这里Use the Azure storage emulator for development and testing,你需要仔细阅读。

其次,根据你的描述,它似乎只是重新初始化模拟器,而不是启动它。

然后,您可以通过命令AzureStorageEmulator status 来检查模拟器状态。

如果没有True,运行netstat -ano | findstr ":1000."检查这些端口是否被其他人占用,找出PID杀死相关端口。

或者正如 GitHub 问题@YASWANTH-MSFT 链接所说,在同一台机器上安装多个不同版本的 SQL Server 实例会导致模拟器无法正常运行,那么您需要删除其中一个 SQL Server。

同时,我建议您也可以升级您的 AzureStorageExplorer 以尝试再次连接模拟器。我可以将旧版本的5.7.0.0 模拟器与最新版本的1.6.2 explorer 连接起来。

【讨论】:

  • 谢谢@彼得潘。我确实卸载了 sql express,但我在尝试让 azure 模拟器工作时遇到了其他几个问题。没有其他 PID 在 azure 存储模拟器端口上运行。
【解决方案2】:

以下是我尝试过的一些方法,最终奏效了。

一个。卸载 sql server express 并仅安装 sql server localdb。

b.确保 HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\UserInstances 父实例键具有正确的值。我来自:LocalDB parent instance version invalid: MSSQL13E.LOCALDB

c。删除 SQL 实例:

sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB

现在删除以下数据库文件:

%USERPROFILE%\AzureStorageEmulatorDb*.mdf
%USERPROFILE%\AzureStorageEmulatorDb*.ldf

最后,重新创建sql实例:

sqllocaldb start MSSQLLocalDB

我从: Azure Storage Emulator fails after adding VS 2015 SDK

d。创建azurestorageemulator init 命令尝试在visual studio=>sql server 对象资源管理器中手动创建的数据库。

e。运行azurestorageemulator start命令,可以看到azurestorageemulator已经启动。

希望这对某人有所帮助。

【讨论】:

    【解决方案3】:

    链接中提到的步骤对我有用,因此请与更广泛的受众分享,以防万一,上述步骤对他们不起作用。它们对我不起作用。

    Github link

    【讨论】:

      猜你喜欢
      • 2019-02-01
      • 1970-01-01
      • 2018-05-18
      • 2017-05-09
      • 1970-01-01
      • 2021-04-23
      • 2021-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多