简体   繁体   中英

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.
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.
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.

If you look at AppData\\Local\\WAStorageEmulator\\WAStorageEmulator.3.3.config you'll find:

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

Thanks to Gaurav on reminding me on logs, I checked my Event Viewer:

Cannot create file 'C:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\WAStorageEmulatorDb33.mdf' because it already exists

It said the SQL DB files exists, so deleted it and retried the command, worked fine and storage emulator also started. (command worked second attempt after some time might be some SQL cache issue)

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.

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

Then you can reinitialize the emulator. So run the Azure Storage Emulator and initialize it with your desired SQL instance:

WAStorageEmulator.exe init -server (local)\\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.
  2. Your server location/instance name may differ. The OPs is (local)\\SQLExpress, mine was (localdb)\\CompanyName. Make sure yours is correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM