74

This error is really driving me crazy. (Terminal running in administrator mode)

Initialization of azure storage emulator in sql server 2014:

C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator>.\wastorage
emulator init -server MY-PC
Windows Azure Storage Emulator 3.0.0.0 command line tool
The storage emulator was successfully initialized and is ready to use.

Error when starting server:

C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator>.\wastorage
emulator start
Windows Azure Storage Emulator 3.0.0.0 command line tool

Unhandled Exception: System.TimeoutException: Unable to open wait handle.
   at Microsoft.WindowsAzure.Storage.Emulator.Controller.EmulatorProcessControll
er.InternalWaitForStorageEmulator(Int32 timeoutInMilliseconds)
   at Microsoft.WindowsAzure.Storage.Emulator.Controller.EmulatorProcessControll
er.EnsureRunning(Int32 timeoutInMilliseconds)
   at Microsoft.WindowsAzure.Storage.Emulator.StartCommand.RunCommand()
   at Microsoft.WindowsAzure.Storage.Emulator.Program.Main(String[] args)
BigChief
  • 1,413
  • 4
  • 24
  • 37

29 Answers29

167

Check if you are running BitTorrent/uTorrent or similar software using port 10000.

Check Steve Marx' blog post about the issue. http://blog.smarx.com/posts/windows-azure-storage-emulator-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process

In case that post disappears, the command to check if any other software is using that port is:

C:\Users\smarx>netstat -p tcp -ano | findstr :10000
  TCP    127.0.0.1:10000        0.0.0.0:0              LISTENING       3672
DeepSpace101
  • 13,110
  • 9
  • 77
  • 127
David Rodriguez
  • 2,412
  • 1
  • 17
  • 15
  • 14
    You just saved us lots of time – Andre Pena Aug 20 '14 at 00:08
  • 27
    I wonder how the microsoft developers build their apps. Rather than the unclear TimeoutException, can't the application just throw "Port Unavailable" exception ?!!! – Jalal El-Shaer Dec 30 '14 at 07:55
  • 1
    It's also worth running without "-p tcp". For me, it was Google Keep. – irwinb Jun 24 '16 at 23:18
  • Thanks, you made my day. – Elvis Nov 07 '16 at 09:33
  • 1
    If you don't like CLI's, hit WinLogo+R %windir%\system32\perfmon.exe /res (or open resource manager from performance tab in task manager), network tab -> tcp connections/listener ports – BigChief Dec 09 '18 at 02:51
  • 1
    For those that find this in 2022, for some reason Azurite has found its way onto my computer, guessing a VS update, THIS is what was taking the port! – Dale Francis Jun 14 '22 at 19:14
47

Summarizing and adding additional points to other answers to this question.

Open C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config file in a notepad or a notepad++ editor. Look at the services section.

<services>
  <service name="Blob" url="http://127.0.0.1:10000/"/>
  <service name="Queue" url="http://127.0.0.1:10001/"/>
  <service name="Table" url="http://127.0.0.1:10002/"/>
</services>

Try to open URL for "Blob" in a web browser. In my case it is

http://127.0.0.1:10000/

If you are unable to open the URL or if there is a error, this is the reason why you are not unable to start Azure Storage Emulator.

Try below steps to resolve the issue.

  1. Check if the port 10000 is busy or used by any other process.

To know this you can type the below command in the command prompt

netstat -na | find "10000"

Kill the process.

Now start the Azure Storage Emulator in -inprocess mode

In the Azure Storage Emulator's command prompt type

AzureStorageEmulator.exe start -inprocess

Ctrl+c and then

AzureStorageEmulator.exe start

If this did not resolve the issue try second step.

  1. Run this

    netsh http add iplisten 127.0.0.1 and then in the Azure Storage Emulator's command prompt type

    AzureStorageEmulator.exe start -inprocess

Ctrl+c and then

AzureStorageEmulator.exe start
InvalidBrainException
  • 2,312
  • 8
  • 32
  • 41
Ram Pratap
  • 1,079
  • 11
  • 8
20

The issue maybe port 10000 is being occupied. Storage emulator runs on port 10000. So you need to kill that process. On windows, open cmd as admin and run following commands.

First find the process occupying port 10000

netstat -ano | findstr :10000

kill the process

taskkill /PID <process id> /F

Now try starting emulator again.

melkorCba
  • 458
  • 5
  • 9
17

I have same issue after Azure tools update (2.3 version). After hours of research I found strange solution - set 'Start Windows Azure storage emulator' to 'False' (in properties of Azure project).

AChudov
  • 214
  • 1
  • 4
  • Sounds indeed like a strange solution. Then the storage emulator does not start? – BigChief May 03 '14 at 14:04
  • 1
    Inexplicably, this worked for me too. Project ran and WA Storage Emulator has started. How bizarre. – glosrob Jun 28 '14 at 14:18
  • 4
    Does it mean, that the Storage Emulator is running, even if you didn't use it before (e.g. after computer reboot)? If yes, than I had probably the same issue. It took me very long time to find it out. Simply the **"System" process (PID 4) was listening on port 10,000**, so it wasn't possible to find, what process was actually causing it. But then I found the Storage Emulator already running (just a process without any UI), so I terminated it and than I was able to start Azure project from Visual Studio, which started Storage Emulator. It seems it's always running after computer reboot. – David Ferenczy Rogožan Sep 18 '15 at 06:25
  • 1
    BTW it's not so bizarre. Just Storage Emulator is simply executed (probably) on system boot or somehow automatically at some point of time, so when you try to start another from Visual Studio, it fails. But only Storage Emulator (TCP port 10,000). Compute Emulator (ports 10,001 and 10,002) is not running, so it has to be executed from VS. – David Ferenczy Rogožan Sep 18 '15 at 06:31
  • 1
    How do set this? @AChudov – Kitwradr May 16 '21 at 13:49
16

In the file C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config you need to change port numbers:

screenshot of changes needed

spottedmahn
  • 14,823
  • 13
  • 108
  • 178
bob
  • 157
  • 1
  • 2
  • Please copy and paste the relevant code into your answer instead of linking to a screenshot of text. – BSMP Jan 22 '20 at 07:40
10

Make sure the user that initialized the emulator is the same as the user that is starting the emulator. Note that if you elevate as a different user to run initialization, then the initialization only applies to that user.

If that doesn't help, you can try to launch the emulator with the -inprocess flag to get a more detailed error message:

WAStorageEmulator start -inprocess
  • 1
    hmzz maybe this might lead to something can you please help to come up with a solution? : 5/3/2014 4:05:28 PM [Info] Stopping Service: Blob Service Status: Blob http://127.0.0.1:10000/ False The process cannot access the file because it is being used by another process Error: Unable to start the storage emulator. – BigChief May 03 '14 at 14:08
  • 1
    @BigChief it probably means that a port is in use. Run the command in the acceptance answer. – irwinb Jun 24 '16 at 23:18
10

Run Microsoft Azure Command Prompt as administrator and try to first initialize using AzureStorageEmulator.exe init and then start using AzureStorageEmulator.exe start commands. It worked for my case.

Geek
  • 101
  • 1
  • 4
  • 1
    Running as Administrator worked for me too. Which is odd, because on another PC, I do not need to use Administrator – Greg Woods Aug 10 '18 at 16:26
9

I had same issue since I had to rejoin my machine to the domain and the user profile got recreated. I noticed that it was starting with option -inprocess from elevated cmd. Then I realized that it has to do with urlac and I solved deleting old ones with following commands:

(from elevated cmd)
netsh http delete urlacl url=http://127.0.0.1:10000/
netsh http delete urlacl url=http://127.0.0.1:10001/
netsh http delete urlacl url=http://127.0.0.1:10002/

After that simply start as usual, the tool will recreate what necessary. Now I can use it without elevation.

Riccardo
  • 171
  • 2
  • 2
8

It is also worth to try to run the command prompt with: "Run As Administrator" and then run the command: C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe start

That did the trick for me!

Don Bar
  • 211
  • 3
  • 11
5

Another option is to change the ip binding that the emulator uses in the config file located in the storage emulator directory.

Find wastorageemulator.exe.config and change

<services>
      <service name="Blob" url="http://127.0.0.1:10000/"/>
      <service name="Queue" url="http://127.0.0.1:10001/"/>
      <service name="Table" url="http://127.0.0.1:10002/"/>
   </services>

This would be usefull if another application is already using that port and you cannot uninstall.

CrazyBernie
  • 174
  • 1
  • 8
  • But that has a consequence that you can't than use the configuration setting `Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString` set simply to `UseDevelopmentStorage=true` in `ServiceConfiguration.Local.cscfg`, but you have to put there full connection string (which is huge and complicated). And that configuration file is part of a project, so everyone, who's developing it, has to reconfigure his Azure Emulator also. – David Ferenczy Rogožan Sep 18 '15 at 06:37
3

if you are trying to start "Azure storage emulator" through Visual Studio=>Server explorer, make sure that you are starting visual studio as an administrator. I was able to get this issue fixed by running the "Azure storage emulator" on the command prompt, by running the command prompt as an administrator.

Ajit Goel
  • 4,180
  • 7
  • 59
  • 107
3
  1. open command prompt as administrator
  2. run command: cd C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator
  3. run command: AzureStorageEmulator start
2

There is some info here that might help:

AzureStorageEmulator.exe init –server MyMachine –sqlinstance **.** –forcecreate –inprocess

See this link.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Choco
  • 1,189
  • 1
  • 14
  • 29
2

I just hit this, and it turns out that Microsoft Teams was using port 10000. Forcing teams to quit resolved the issue.

Paul Batum
  • 8,165
  • 5
  • 40
  • 45
2

For me there was nothing running on the needed ports, the issue was that Visual Studio was not started in Administrator mode so the process couldn't be started.

When I went to the Azure Storage Emulator CLI from "Start" that launches a command shell that is also not in Administrator mode which obviously produces the same result.

Opening a command shell in Admin mode did the job.

Richard Hauer
  • 1,298
  • 9
  • 22
2

Windows Backup Agent was running on my VM box on port 10000 - moving to 10003 (via the .exe.config file worked)

Rory Solley
  • 1,435
  • 1
  • 9
  • 6
2

First you should initialize the emulator database and configuration be starting AzureStorageEmulator.exe as administrator with a key init: AzureStorageEmulator.exe init

Then, if you still receive an error:

Service Status: Blob http://127.0.0.1:10000/ False The process cannot access the file because it is being used by another process Error: Unable to start the storage emulator.

try to change 127.0.0.1 to localhost for all services in C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config

2

It worked for me:

  1. Press the Windows key and search "Azure Storage Emulator"
  2. It shows me an error message "..Cannot create the database "AzureStorageEmulatorDb510"
  3. I opened the SSMS and looked for that database but I found "AzureStorageEmulatorDb59"
  4. I renamed the database to "AzureStorageEmulatorDb510"
  5. Try again run "Azure Storage Emulator"
2

The reason for me was Hyper-V. It reserves a lot of ports. You can check reserved ports netsh int ip show excludedportrange protocol=tcp. Easiest solution - change ports in config file.

Cute pumpkin
  • 342
  • 3
  • 17
2

I had the same problem, I tried many ways, nothing was blocking port 10000. I tried updating the emulator config to Localhost instead of 127.0.0.1 here

<services>
  <service name="Blob" url="http://127.0.0.1:10000/"/>
  <service name="Queue" url="http://127.0.0.1:10001/"/>
  <service name="Table" url="http://127.0.0.1:10002/"/>
</services>

but I had the timeout issue again.

Finally, I had to uninstall my IIS. and problem solved. there should be a way to make them work together.

Karvan
  • 250
  • 2
  • 7
1

I have had this happen recently, and it was because I'd recently installed the HDInsight emulator. It appears this was auto-starting the storage emulator causing an error when VS attempted to start it resulting in an error.

Setting the "Start Microsoft Azure storage emulator" value to False worked in this case also.

SteveM1972
  • 11
  • 1
1

I encountered the same problem. I found out that, the port 10000 is being used by another process. In my case, utorrent was using it. It could be Bittorrent if that's what you are using. After uninstalling it, it started smoothly with altering my data.

If your torrent downloader means so much to you, you can consider solving your issue from that angle. I hope this works.

Williams Adu
  • 149
  • 1
  • 12
1

For users of the newly released documentdb emulator...Microsoft thought it is a good idea that the documentdb emulator uses the same port as the Storage emulator ;) The only way you can access your storage is by shutting down documentdb emulator and restart Visual Studio and voila you can use it again :facepalm:

Hypi
  • 127
  • 1
  • 8
1

I got similar issue with visual studio while trying to run Azure Functions. AzureStorageEmulator.exe init worked for me

Preeti Joshi
  • 841
  • 1
  • 13
  • 20
1

I experienced a power outage and after rebooting received the Unhandled Exception: System.TimeoutException message attempting to launch and debug an Azure Functions project from Visual Studio 2019. I tried many (if not all) of the other suggested answers on this thread to no avail. Including but not necessarily limited to ...

  1. Checking for processes using ports 10000-10002, (none were)
  2. Running Visual Studio and/or AzureStorageEmulator as administrator
  3. Deleting / recreating the storage database
  4. Attempted netsh http add iplisten 127.0.0.1 etc. from @Ram Pratap's answer
  5. Changed hostname and port number bindings
  6. Tried AzureStorageEmulator init and AzureStoreEmulator start -inprocess

What finally worked for me was ...

  1. Installing the Storage Emulator using the standalone installer
  2. This then allowed me to fully uninstall just the Storage Emulator using Add & Remove Programs, followed by a restart.
  3. Next I reinstalled the Storage Emulator using the standalone installer, followed by a restart.
  4. Finally I ran AzureStorageEmulator start it worked!
LeastOne
  • 370
  • 4
  • 14
1

Had the same issue, deleting the AzureStorageEmulatorDb510* files in my user folder(C:\Users{UserName}) and running C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init /forceCreate solved it for me. I was then able to start with AzureStorageEmulator.exe start. Also ran the Cmd.exe in administrator mode.

1

Had the same issue, node.exe is usually the one using port 127.0.0.1:1000 to 10003, which are used for StorageEmulator as well. so easy solution to try is, kill the node process from task manager, Also test by stopping the IIS (if on windows) and test if everything works fine.

zetawars
  • 1,023
  • 1
  • 12
  • 27
1

In my case AzureStorageEmulator.exe was throwing this error because i updated my VS 2022 and it installed azurite with it which was holding the port :10000.

I solved this by ending the task in Task Manager

As pointed out by Dale Francis in one of the comments of top answer

Ali Khan
  • 138
  • 9
1

IDK but none of the solutions work for me. Then accidently I noticed an icon in my taskbar hidden items. It was showing me that my computer emulator is shutdown. Once I start the emulator by following the shown steps it is working fine. enter image description here

enter image description here

yuv
  • 499
  • 1
  • 7
  • 14