简体   繁体   English

如何配置Azure存储模拟器以使用本地SQLServer

[英]How to Configure Azure Storage Emulator to work with local SQLServer

I am trying to configure Azure Storage Emulator 2.4 work with Local SQL server 2012. 我正在尝试使用Local SQL server 2012配置Azure存储模拟器2.4。
When I execute this command, I get cannot create Database. 执行此命令时,无法创建数据库。

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>WAStorageEmulator.exe init -server ThisPC -sqlinstance SQLEXPRESS -forcecreate

Windows Azure Storage Emulator 3.3.0.0 command line tool
Error: Cannot create database.

To my Sql Sever Manager I login using server name ThisPC\\SQLEXPRESS. 到我的Sql Sever Manager我使用服务器名称ThisPC \\ SQLEXPRESS登录。
Please help me on which information i have missed. 请帮我告诉我错过了哪些信息。

----------------- Updated ----------------- - - - - - - - - - 更新 - - - - - - - - -

C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator>WAStorageEmulator.exe init -server (local)\\SQLExpress -forcecreate

Windows Azure Storage Emulator 3.3.0.0 command line tool Error: Cannot create database. Windows Azure存储模拟器3.3​​.0.0命令行工具错误:无法创建数据库。

If you look at AppData\\Local\\WAStorageEmulator\\WAStorageEmulator.3.3.config you'll find: 如果查看AppData \\ Local \\ WAStorageEmulator \\ WAStorageEmulator.3.3.config,您将找到:

<SQLInstance>(local)\SQLExpress</SQLInstance>

Thanks to Gaurav on reminding me on logs, I checked my Event Viewer: 感谢Gaurav提醒我日志,我检查了我的事件查看器:

Cannot create file 'C:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\WAStorageEmulatorDb33.mdf' because it already exists 无法创建文件'C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL10.SQLEXPRESS \\ MSSQL \\ DATA \\ WAStorageEmulatorDb33.mdf',因为该文件已存在

It said the SQL DB files exists, so deleted it and retried the command, worked fine and storage emulator also started. 它说SQL DB文件存在,因此删除了该文件并重试了该命令,工作正常,并且存储模拟器也已启动。 (command worked second attempt after some time might be some SQL cache issue) (命令在一段时间后第二次尝试可能是某些SQL缓存问题)

I would like to propose an answer based on the information from the OP's post/comments for readers from the future who get here after a some searching. 我想基于OP的帖子/评论中的信息提出一个答案,这些信息来自未来的读者,经过一些搜索后会到达这里。

It is quite easy, and really the main piece of pertinent information is that you must first delete the existing database file located at: 这很容易,并且实际上相关的主要信息是您必须首先删除位于以下位置的现有数据库文件:

C:\\Users\\\\WAStorageEmulatorDb33.mdf C:\\用户\\\\ WAStorageEmulatorDb33.mdf

Then you can reinitialize the emulator. 然后,您可以重新初始化仿真器。 So run the Azure Storage Emulator and initialize it with your desired SQL instance: 因此,运行Azure存储模拟器并使用所需的SQL实例对其进行初始化:

WAStorageEmulator.exe init -server (local)\\SQLExpress WAStorageEmulator.exe init -server(本地)\\ SQLExpress

Things that can go wrong: 可能出错的事情:

  1. You may not be running the command prompt with elevated permissions. 您可能没有使用提升的权限运行命令提示符。 Usually Windows will prompt you if you wish to allow it to make changes, but it if doesn't and you get a failure message, run the tool with administrator permissions. 通常,如果您希望允许更改,Windows会提示您,但如果没有 ,则会收到失败消息,请运行具有管理员权限的工具。
  2. Your server location/instance name may differ. 您的服务器位置/实例名称可能有所不同。 The OPs is (local)\\SQLExpress, mine was (localdb)\\CompanyName. OP是(本地)\\ SQLExpress,我的是(localdb)\\ CompanyName。 Make sure yours is correct. 确保你的是正确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Azure Compute Emulator上配置Web角色以像本地IIS(静态URL)一样工作 - How to configure Web role on Azure Compute Emulator to work like local IIS (static URL) 如何使用 Powershell 连接到本地 Azure 存储模拟器? - How to use Powershell to connect to local Azure Storage emulator? 如何通过wifi访问Azure存储模拟器(本地)? - How to access Azure Storage Emulator (Local) over wifi? 使用 Azure 存储模拟器进行 Dapr 本地开发 - Use Azure Storage Emulator for Dapr Local Development Azure 存储资源管理器未连接到 Azurite 本地模拟器 - Azure Storage Explorer not connecting to Azurite local emulator 如何使用自定义端口配置 Azure 角色以连接到 Windows Azure 存储仿真器? - How do I configure an Azure role to connect to Windows Azure Storage Emulator using custom ports? 如何验证Azure存储模拟器? - How to authenticate Azure storage emulator? 如何设置HDInsight的输入/输出路径以指向本地存储模拟器中的Azure Storage Vault(ASV)? - How to set HDInsight's input/output paths to point to Azure Storage Vault (ASV) in local storage emulator? Microsoft Azure 存储资源管理器不加载本地模拟器存储 - Microsoft Azure Storage Explorer does not load local emulator storage 有没有办法将Blob从本地存储模拟器复制到远程Azure存储? - Is there a way to copy a blob from the local storage emulator to a remote azure storage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM