简体   繁体   中英

unable to connect to local Azure storage account

I have initialized a azure storage emulator on my local box but I am unable to connect to it from either visual studio or Azure storage explorer. What am i missing?

Error when i try to connect to a local azure storage account emulator:

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

Error in visual studio server explorer if i try to explore storage=>Development:

  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.

Command to initialize the Azure storage emulator on my machine.

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.

Update: I tried to a. add the same name as provided in C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator\\storageemulatorexplorer.exe.config b. add http://127.0.0.1 to the local interanet zones in internet explorer, c. delete the files in %AppData%\\Roaming\\StorageExplorer but none of the options above helped.

Azure Storage explorer screenshot Azure 存储资源管理器截图

First, all about the usage of Azure Storage Emulator are in here Use the Azure storage emulator for development and testing , which you need to read carefully.

Second, just per your description, it seems to just re-initialize the emulator, but not start it.

在此处输入图片说明

Then, you can check the emulator status via command AzureStorageEmulator status . 在此处输入图片说明

If there is not True , to run netstat -ano | findstr ":1000." netstat -ano | findstr ":1000." to check whether these ports were occupied by others and find out the PID to kill the related one. 在此处输入图片说明

Or as the GitHub issue @YASWANTH-MSFT linked said, multiple instances of different version of SQL Server installed on the same machine will cause the emulator not running normally, then you need to remove one of these SQL Server.

Meanwhile, I suggest you also can upgrade your AzureStorageExplorer to try to connect the emulator again. I can connect my old version 5.7.0.0 emulator with the newest version 1.6.2 explorer.

在此处输入图片说明

Here are some of the things that i tried and it finally worked.

a. uninstall sql server express and install only sql server localdb.

b.make sure that the HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\UserInstances parentinstance key has the correct value. I got this from: LocalDB parent instance version invalid: MSSQL13E.LOCALDB

c. Delete the SQL instance:

sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB

Now delete the following database files:

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

Finally, recreate the sql instance:

sqllocaldb start MSSQLLocalDB

i got this from: Azure Storage Emulator fails after adding VS 2015 SDK

d. Create the database that the azurestorageemulator init command tries to create manually in visual studio=>sql server object explorer.

e. Run the azurestorageemulator start command to see the azurestorageemulator has been started.

Hopefully this helps someone.

The steps mentioned in the link worked for me, so sharing it with wider audience, just in case, above steps don't work for them. They didn't work for me.

Github link

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