【问题标题】:Azure storage emulator failed to initialize for Azure SDK 2.4Azure 存储模拟器无法为 Azure SDK 2.4 初始化
【发布时间】:2014-10-18 16:09:17
【问题描述】:

我正在学习如何使用 Microsoft Azure Tools for Visual Studio 开发 Azure 云服务:“Getting Started with the Azure Tools for Visual Studio”。

我成功完成了以下步骤: 1. 安装 Azure 工具。 2. 创建 Azure 云服务。

第三步是构建和调试云服务,我被卡住了。 调试时出现错误“无法初始化 Microsoft Azure 存储模拟器”。

我确实尝试了各种网站上提供的各种方法来初始化存储模拟器,但没有一个对我有用。

当我尝试命令 WAStorageEmulator.exe init 时,我收到一个错误“无法创建数据库”。

任何帮助将不胜感激。

【问题讨论】:

  • 它对我有用。无需在安全模式下启动机器,只需修改配置文件并运行存储模拟器。

标签: azure


【解决方案1】:

我遇到了类似的问题,听起来像是此处发布的答案之一: This post talks about removing old mdf files so you can install again

这似乎更接近您的体验。

希望对你有帮助

【讨论】:

  • 我尝试删除 mdf 文件,但它并没有帮助我解决问题@Andres。
【解决方案2】:

第 1 步:以安全模式启动系统(在计算机开机或重新启动后立即按 F8 键进入安全模式)。

第 2 步:在安全模式下,进入路径 C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator

第 3 步:搜索 WAStorageEmulator.exe - 配置文件。

第 4 步:使用 Notepad++(任何编辑器)编辑 WAStorageEmulator.exe

第 5 步:如上图所示更改端口号。 (默认端口号为 10000、10001、10002)。

<services>
  <service name="Blob" url="http://127.0.0.1:30000/"/>
  <service name="Queue" url="http://127.0.0.1:30001/"/>
  <service name="Table" url="http://127.0.0.1:30002/"/>
</services>

第 6 步:保存文件并以正常模式重新启动系统并运行程序。

我希望这会有所帮助。

【讨论】:

  • 您不必在安全模式下启动系统,只需将原始 .config 文件复制粘贴到您的桌面,在那里进行更改并将其复制粘贴回 Storage Emulator 文件夹。您需要管理员权限才能执行此操作。我在 Windows 7 上做到了。
  • Daystate 是对的。我只是复制文件,编辑它并复制回来。然后重启 VS 2013(不重启系统),它又开始工作了。奇怪,在过去一周左右我遇到了几次问题,但我可以在重新启动我的电脑后再次重新启动它。然而,这一次,它不再起作用了。这就是为什么如果我最后降落在这里。
  • 这解决了我的问题。谢谢
  • 我遇到了同样的问题,我正在使用存储模拟器 v5.2。在这个版本中没有 WAStorageEmulator.exe 配置文件,你必须编辑 AzureStorageEmulator.exe.config 文件。无需在安全模式下运行,只需要管理员权限(您可以在 Notepad++ 中进行编辑)。然后再次从VS运行它,它可以工作:)
【解决方案3】:

打开 MS Azure 命令提示符。类型(取决于您的本地数据库名称):

SqlLocalDb 停止项目v12

SqlLocalDb 删除项目v12

然后去

C:\Users(admin)\AppData\Local\Microsoft\Microsoft SQL Server 本地 DB\Instances

然后我删除了那里的所有实例。然后尝试重新安装 Azure 存储模拟器。这对我有用。

【讨论】:

  • 非常感谢。这对我有用。我推荐这个解决方案。
【解决方案4】:

根据接受的答案,不需要重新启动。

  1. 在管理员模式下打开一个 Powershell 窗口。
  2. 输入以下命令:netstat -p tcp -ano | findstr :10000

这将告诉您使用模拟器指定端口的进程 ID。 使用任务管理器详细信息中的详细信息选项卡查找进程 ID 的关联应用程序。通常这类似于 bittorrent/utorrent。

  1. 终止该进程,您就完成了。

..

但如果您在开发时绝对必须运行有冲突的应用程序,那么您可以更改模拟器使用的端口。

要更改模拟器使用的端口,然后在powershell中:

chdir "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator"
.\WAStorageEmulator stop

然后根据接受的答案编辑配置文件并保存。

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\WAStorageEmulator.exe.config

您无需在任何地方复制它。然后回到 Powershell 并:

.\WAStorageEmulator status
.\WAStorageEmulator start

【讨论】:

    【解决方案5】:

    确保您已安装 SQL Server Express 或 SQL LocalDb。然后你应该可以输入

    .\AzureStorageEmulator.exe init

    或者,在这种较旧的情况下:

    .\WAStorageEmulator.exe init

    ...它应该安装默认数据库。注意我使用的是 PowerShell 语法。如果使用命令提示符,则减去 .\ 部分。

    与其他帖子的建议相反,这并不总是端口冲突。

    您可以在此处下载 SQL Server Express 版本:

    https://www.microsoft.com/en-us/sql-server/sql-server-editions-express

    运行命令时应该会看到如下内容:

    PS C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator> .\AzureStorageEmulator.exe init
    Windows Azure Storage Emulator 5.10.0.0 command line tool
    Empty SQL Instance. Autodetecting SQL Instance to use.
    Looking for a LocalDB Installation.
    Probing SQL Instance: '(localdb)\MSSQLLocalDB'.
    Caught exception while probing for SQL endpoint. Login failed for user 'somedomain\someguy'.
    Number of SqlErrors Reported: 1
    SqlError: System.Data.SqlClient.SqlError: Login failed for user 'somedomain\someguy'.
    Could not find a LocalDB Installation.
    Probing SQL Instance: 'localhost\SQLExpress'.
    Found SQL Instance localhost\SQLExpress.
    Creating database AzureStorageEmulatorDb510 on SQL instance 'localhost\SQLExpress'.
    
    Granting database access to user somedomain\someguy.
    Database access for user somedomain\someguy was granted.
    
    Initialization successful. The storage emulator is now ready for use.
    The storage emulator was successfully initialized and is ready to use.
    PS C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>
    

    【讨论】:

      【解决方案6】:

      问题与具有权限的“(localdb)\MSSQLLocalDB”SQL服务有关。 最好的选择是使用以下命令, 步骤 1: 进入路径“C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator

      步骤 2:Administrator 身份打开 PowerShell

      第 3 步: 运行PowerShell 中执行以下命令, “AzureStorageEmulator.exe 初始化服务器。 -sqlinstance SQLEXPRESS -forcecreate” 下面是输出,

      第四步: 运行下面的命令PowerShell中启动模拟器, “AzureStorageEmulator.exe 启动” 下面是输出,

      第 5 步: 然后检查“SQLEXPRESS数据库, 新数据库已创建。

      现在您可以使用存储模拟器了。

      【讨论】:

        猜你喜欢
        • 2016-02-03
        • 1970-01-01
        • 2014-09-09
        • 2014-10-20
        • 2016-04-03
        • 2023-03-23
        • 1970-01-01
        • 2021-09-12
        • 2014-06-12
        相关资源
        最近更新 更多