azure-cosmosdb

Azure Cosmos DB on ERR_CONNECTION_REFUSED after installation


I am trying to setup the Azure Cosmos DB Emulator for development on my local environment.. I downloaded the emulator and followed the instruction on the Microsoft Docs page. After initial setup, when the service start and I try to open https://localhost:8081/_explorer/index.html which is supposed to give me the explorer I get an ERR_CONNECTION_REFUSED error.

I also tried deleting the data directory as the docs say but that still does not work.

I thought it might be an error with the firewall so I granted the Application access but I still get the same error.


Solution

  • You're running this command in Windows Terminal which opens a PowerShell console. To run an executable, you will have to prepend .\ to the executable name (the same is mentioned in the error message as well.

    So, try running your command as .\Microsoft.Azure.Cosmos.Emulator.exe and that should work.

    More on this can be found here: https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx. From this link:

    If a cmd is used without the prefixed '.\', it is only run if it is in the environment path. PowerShell does not execute from the current directory without it.

    Also, you're getting this connection refused error is because the emulator is not running. Once you run the emulator successfully, you should not see this connection refused error.