简体   繁体   中英

Azure storage emulator failed to initialize for Azure SDK 2.4

I was learning how to use the Microsoft Azure Tools for Visual Studio to develop an Azure cloud service at :" Getting Started with the Azure Tools for Visual Studio ".

I successfully completed the following steps: 1. Install the Azure tools. 2. Create an Azure cloud service.

3rd step was build and debug the cloud service, where i was stuck. While debugging i got an error "Failed to initialize Microsoft Azure Storage Emulator".

I did try various methods given on various websites to initialize the Storage Emulator, but none of them worked for me.

When I was trying the command WAStorageEmulator.exe init , i got an error "cannot create database".

Any help would be greatly appreciated.

Step 1 : Start your system in safe mode (Immediately after the computer is powered on or restarted tap the F8 key to enter safe mode).

Step 2 : In safe mode go the path C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator .

Step 3 : Search for WAStorageEmulator.exe - config file.

在此处输入图片说明

Step 4 : Edit WAStorageEmulator.exe with Notepad++ (any editor).

在此处输入图片说明

Step 5 : Change the port numbers as shown in the above snapshot. (By default the port numbers will be 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>

Step 6 : Save the file and restart your system in normal mode and run the program.

I hope this helps.

I had a similar problem and it sounds like one of the answers posted here: This post talks about removing old mdf files so you can install again

This seems to be closer to what you are experiencing.

I hope this helps

Open MS Azure Command Prompt. Type (depending on your local db name):

SqlLocalDb stop projectv12

SqlLocalDb delete projectv12

Then go to

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

and I deleted all instance in there. Then try re-install the Azure storage emulator. This worked for me.

A re-boot is not neccesary as per the accepted answer.

  1. Open a Powershell window in admin mode.
  2. Enter the following command: netstat -p tcp -ano | findstr :10000 netstat -p tcp -ano | findstr :10000

That will tell you what process id is using the emulator designated port. Use the Detail Tab in Task Manager detail to find the associated application for the process id. Often times this is something like bittorrent/utorrent.

  1. Kill that process and you're done.

..

But if you absolutely must run the conflicting application while you develop then you can change the ports used by the emulator.

To change the ports used by the emulator, then in powershell:

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

Then edit the config file as per the accepted answer and just save it.

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

You don't need to copy it anywhere. Then back into Powershell and :

.\WAStorageEmulator status
.\WAStorageEmulator start

Make sure you have SQL Server Express or SQL LocalDb installed. You should then be able to type

.\\AzureStorageEmulator.exe init

Or, in this older case:

.\\WAStorageEmulator.exe init

...and it should install the default database. Note I'm using the PowerShell syntax. If using the command prompt, it's minus the .\\ portion.

It's not always a port conflict, contrary to what other posts may suggest.

You can download SQL Server Express editions here:

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

You should see something like this when you run the command:

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>

The problem is with the “ (localdb)\\MSSQLLocalDB ” SQL Service with Permissions . The best option is using below commands, Step 1: Go the path “ C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator存储模拟器路径

Step 2: Open PowerShell as Administrator ,以管理员身份打开 PowerShell

Step 3: Run the below command in PowerShell , “ AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate ” Below is the output, PowerShell 输出 01

Step 4: Run the below command in PowerShell to Start Emulator, “AzureStorageEmulator.exe start” Below is the output,PowerShell 输出 02

Step 5: After that check the “ SQLEXPRESSDatabases , New Database is created.数据库

Now you can use the Storage Emulator .存储模拟器

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