MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

Cosmos DB Emulator wont start #6788

Closed Frankwayne closed 6 years ago

Frankwayne commented 6 years ago

I cant seem to start the Cosmos DB Emulator. I have windows 10 and it appears to install fine, but when I click to start it up I see the tray icon appear and then it disappears before I can click on it. The localhost landing page "https://localhost:8081/_explorer/index.html" does not appear and I cannot navigate to it either

I have tried to restart my machine. Uninstall the application. Turn off the IIS web server I use for debugging but nothing appears to work.

I have ran the command "lodctr /R" and got a successful message back from running it, it still wont start.

I tried to look for the crash dumps at c:\Users\user_name\AppData\Local\CrashDump but I see no crashDump files

I have tried to launch the Emulator as an administrator but it still wont start.

I tried to Collect trace files with the following steps

  1. cd /d "%ProgramFiles%\Azure Cosmos DB Emulator"
  2. CosmosDB.Emulator.exe /shutdown. Watch the system tray to make sure the program has shut down, it may take a minute. You can also just click Exit in the Azure Cosmos DB emulator user interface.
  3. CosmosDB.Emulator.exe /starttraces
  4. CosmosDB.Emulator.exe
  5. Reproduce the problem. If Data Explorer is not working, you only need to wait for the browser to open for a few seconds to catch the error.
  6. CosmosDB.Emulator.exe /stoptraces
  7. Navigate to %ProgramFiles%\Azure Cosmos DB Emulator and find the docdbemulator_000001.etl file. Send the .etl file along with repro steps to askcosmosdb@microsoft.com for debugging.

but I dont get any trace files either. Im not sure what is wrong at this point in time


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

MohitGargMSFT commented 6 years ago

@Frankwayne Thanks for the feedback. Please help us with the link of the document on which above feedback is provided.

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Can you try the following as detailed in this Stack Overflow thread: documentdb emulator gatewayservice crashing on startup

C:\WINDOWS\system32>LODCTR /R

You may need to run this twice. Regards, Mike

Frankwayne commented 6 years ago

@Mike-Ubezzi-MSFT Sure I ran the commands and it still wont start up but I did try the debugging command for the gatewayservice and this is what I got

PS C:\Program Files\Azure Cosmos DB Emulator\Packages\GatewayService\GatewayService.Code> .\DocumentDB.GatewayService.exe /?

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Fabric, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.Azure.Documents.Azure.GatewayService.GatewayHost.Main()

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Can you send this information to the askcosmosdb@microsoft.com alias, where the Cosmos DB product group can review this and provide assistance. If you cannot provide an .etl file, provide the information you have provided in your last comment (collect trace files).

The other option is to uninstall and reinstall.

Frankwayne commented 6 years ago

@Mike-Ubezzi-MSFT I have sent them an email, and if I get a working solution I will post the information on how to correct the system on this issue case.

Thanks for your help

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion. Any resolution provided by the Cosmos DB team can still be posted here in a 'closed' status. Regards, Mike

David-Noble-at-work commented 6 years ago

@Frankwayne Hi there, I'm the dev owner of the Emulator and would like to get to the bottom of this. Are you up for a remote Skype session? Best, David Noble

Frankwayne commented 6 years ago

@David-Noble-at-work Certainly. What times work best for you ? I'm on the east coast and this is work related so I can also have a session during work hours as well. I'm also free this sunday too.

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Did this get resolved? Thanks, Mike

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion. You have the option of reaching Cosmos DB Emulator support via askcosmosdb@microsoft.com per the instructions outlined here. Regards, Mike

Frankwayne commented 6 years ago

@Mike-Ubezzi-MSFT no we have not resolved this issue. I have been waiting for mike to David to get back to me when we could do the skype session

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne I am going to try to assist you and with the information we uncover, hopefully we identify the issue or I will have enough to pass on to @David-Noble-at-work and the askcosmosdb email alias. If you go to Event Viewer (Local) > Windows Logs > Application, and look for any CosmosDB.Emulator entries, do you see any start-up failure entries? I have over 200 Informational entries pertaining to my Cosmos DB Emulator starting up.

The other option is to trying starting the Emulator on another port (the default is 8081). Make use the Emulator is completely stopped before attempting to restart:

Command-Line Tool Reference

Controlling the Emulator

This requires using PowerShell. I can work with you via Skype, if you desire.

Regards, Mike

Frankwayne commented 6 years ago

@Mike-Ubezzi-MSFT I see no logs in the windows/Application event viewer logs for the CosmosDB.Emulator source.

Starting the emulator on another port with the command

.\CosmosDB.Emulator.exe /port=8085 gives the same behavior where nothing happens, I can see the icon when I open my hidden icons on my system tool tray and then it disappears. I have also ran the /shutdown command as well before running the /port command and I still get the same behavior.

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Are you available for a Skype Call at this time? I have @David-Noble-at-work available to look into this issue. If not now, please provide a couple times that will fit your schedule. Thanks!

David-Noble-at-work commented 6 years ago

@Frankwayne what version of the Emulator are you running? The current version is 1.22 which was published on 2018.04.20. Please install it from here, if you've not got the latest.

Frankwayne commented 6 years ago

@David-Noble-at-work I had 1.21 just installed the 1.22 version

nothing in the event viewer this time either. I'm open for a skype session to debug this issue whenever. I just have an engagement this Saturday

Frankwayne commented 6 years ago

Is it possible that there is something blocking the process ? I looked in my antivirus but its not reporting any blocked process. My co-workers also have the same antivirus but they have no issues.

Maybe I need to open something in windows firewall or something.

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Is this a plain-vanilla Windows 10 machine? If not, what software is installed?

Even though the latest 1.22 version has been installed, please follow these steps:

• Ensure that all emulator processes are stopped: CosmosDB.Emulator DocumentDB.GatewayService DocumentDB.Master DocumentDB.Server

• Delete the data directory: %LOCALAPPDATA%\CosmosDBEmulator

• Uninstall the Emulator

• Download and install the current version of the Emulator (v1.22) from https://aka.ms/cosmosdb-emulator without starting it.

• Start the emulator from a command line

cd "%ProgramFiles%\Azure Cosmos DB Emulator" CosmosDB.Emulator.exe /starttraces CosmosDB.Emulator.exe

• Wait until the emulator is fully started as reported from the task bar and if we get that far, create some data.

If the Emulator fails to start, we might enable fusion logs and repeat the prior steps.

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne I want to check in to see if you have resolved this or if you still have issues with the emulator. Thanks, Mike

Mike-Ubezzi-MSFT commented 6 years ago

We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

Frankwayne commented 6 years ago

sorry I had other important work take my time away from this issue. I'm still facing this issue.

I have SQL server 2017, visual studio 2017, Azure service fabric sdk. This is my dev machine so I got a whole bunch of stuff installed. if you want a full list I can run the powershell command

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

which should get you a list of most of the installed software

there was no folder in the follow dir %LOCALAPPDATA%\CosmosDBEmulator AKA Users{username}\AppData\CosmosDBEmulator

I dont see any of the process running in task manager

CosmosDB.Emulator DocumentDB.GatewayService DocumentDB.Master DocumentDB.Server

uninstalling and reinstalling does not appear to help either. Can I get the steps to enable the fusion logs ?

Mike-Ubezzi-MSFT commented 6 years ago

@Frankwayne Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

Jiping-hi commented 6 years ago

same issue here. page( https://localhost:8081/_explorer/index.html) shows the following:

This site can’t be reached The connection was reset. Try:

Checking the connection Checking the proxy and the firewall Running Windows Network Diagnostics ERR_CONNECTION_RESET

Mike-Ubezzi-MSFT commented 6 years ago

@Jiping-hi Can you please do a netstat -a and identify any existing services that are listening on the ports you have configured for CosmosDB.Emulator.

Jiping-hi commented 6 years ago

I should tell before that I remote desktop to a Windows Server using my Domain Account Administrator.

  1. changing port doesn't work;
  2. found error log in "Event Viewer(local) > Windows Logs > Application", two related error logs, one says:

Application: DocumentDB.StartupEntryPoint.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Security.Principal.IdentityNotMappedException at System.Security.Principal.NTAccount.Translate(System.Security.Principal.IdentityReferenceCollection, System.Type, Boolean) at System.Security.Principal.NTAccount.Translate(System.Type) at Microsoft.Azure.Documents.Common.SecurityUtil.AccountNameToSid(System.String) at Microsoft.Azure.Documents.Services.ServiceStartupEntryPoint.ServiceStartupEntryPoint.GetSecurityGroupSid(System.String) at Microsoft.Azure.Documents.Services.ServiceStartupEntryPoint.ServiceStartupEntryPoint.GatewayInit(System.Fabric.CodePackageActivationContext) at Microsoft.Azure.Documents.Services.ServiceStartupEntryPoint.ServiceStartupEntryPoint.Main(System.String[])

Mike-Ubezzi-MSFT commented 6 years ago

@Jiping-hi Can you please follow the steps outlined in Troubleshooting, followed by sending the data collected in Collect trace files, and send the information to askcosmosdb@microsoft.com

Thank you!

Jiping-hi commented 6 years ago

Thanks, Mike. It seems the Domain Controller role caused this.

Don't bother, I will use other ways to run Cosmos DB, like a Docker or VM, or other non-AD Windows machine.

Mike-Ubezzi-MSFT commented 6 years ago

@Jiping-hi We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

Yaming-Hub commented 6 years ago

@Mike-Ubezzi-MSFT I hit the same issue and posted in https://github.com/Azure/azure-cosmosdb-dotnet/issues/471 . Can we re-open this issue and follow up on it? The issue shouldn't be hard to fix.

Mike-Ubezzi-MSFT commented 6 years ago

@Yaming-Liu1978 Can you open a new GitHub Issue from this document: https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator That way we have a new instance with only a single issue to be solved with root cause detailed. Thank you.

David-Noble-at-work commented 6 years ago

@Yaming-Liu1978 The Emulator is not designed to run on a domain controller. In short it cannot be run on a machine with Active Directory installed. The Emulator creates a number (3) of group accounts that it uses for security purposes. You found one of them: DocDBGatewayService. Does your dev/test environment provide an alternative to installing the Emulator on a machine together with Active Directory?

vincez commented 6 years ago

Hey David, this seems to be a regression in the emulator. I've been using it since its first release on a domain-joined virtual machine. This only broke when I upgraded to 2.0.0. Can you look into what caused the regression?

JipingWang commented 6 years ago

DA is very special, I've found many applications require no DA. I will never install DA if possible(fortunately, we have Azure AD now), otherwise would not install Cosmos DB on DA.

vincez commented 6 years ago

This issue impacts machines joined with an Azure AD directory as well. This issue is a regression that bricks the emulator for users who want to use (or are required to use) single-sign-on for their development machines.

DarkCompiled commented 5 years ago

I also have problems starting the new version of the emulator (2.0.0.0). The emulator seems to start perfectly, but Data Explorer web page says "ERR_CONNECTION_REFUSED". And I'm also unable to reach the emulator API.

I already tried to uninstall and reinstall - still does not work. I rebooted the computer several times - still does not work. I tried to run "LODCTR /R" several times - still does not work. I also enabled traces with "CosmosDB.Emulator.exe /starttraces", I'm not sure, but maybe that is why I got a "docdbemulator_000001.etl" with 187MB in just a few minutes.

Can please someone help me out?

EDIT: I found this other issue: https://github.com/Azure/azure-cosmosdb-dotnet/issues/470 I followed the steps mentioned by ToddTaylor, and it worked. Apparently the new installer was not able to completely delete the old folder, some assemblies were still there and were causing some issues. I also found out I had two version of the emulator installed (like andreas mentions), so probably removing both would also work.

andreasfredriksson commented 5 years ago

I had the same problem. I discovered that I had two versions of the emulator installed. 2.0 and 1.1.2. I uninstalled both of them from Apps and functions (that I think the English translation would be, I have a Swedish version of Windows 10).

Then I installed 2.0 again. Now the Data Explorer web page works again.

sksallaj82 commented 5 years ago

This just happened to me tonight. I have a demo I have to show tomorrow, and then this happens:

This site can’t be reached localhost refused to connect. Try:

Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED

I tried to uninstall, I removed any residuals, removed the directory, reinstalled, and same problem. This didn't happen 5 days ago, and nothing changed since then. No idea how to resolve this, and I'm running out of options.

I even upgraded it to 2.1.2, and still nada.

sksallaj82 commented 5 years ago

I did this...

netsh http add iplisten ipaddress=0.0.0.0

and it worked... wow

jderus commented 5 years ago

I am having the same problem with 2.1.x.

IlyaNikitinMs commented 5 years ago

When I updated to 2.* my previous version was still installed and interfered with current.

  1. Uninstall all versions of emulator
  2. Reboot
  3. Install latest These simple steps actually helped me.
jderus commented 5 years ago

Thanks @IlyaNikitinMs I will give it a shot. Perhaps the team should work on a more robust and easy upgrade path, moving forward?

jderus commented 5 years ago

Yup @IlyaNikitinMs Something very close to your steps seems to be working. Thanks again :)

ifexception commented 5 years ago

Hi, I am experiencing a similar issue to what @Frankwayne reported. This is on version 2.1.4-44c12ee7. The CosmosDB emulator just keeps shutting down with no etl traces or anything of that sort immediately after starting it.

Based on what said here earlier, I attempted to start the Microsoft.Azure.Cosmos.GatewayService.exe and I get a COMExcpetion. It seems to be unable to find a environment option....

Should I create a new issue or would someone want to re-open this issue again?

(I have tried the aforementioned steps mentioned by @Mike-Ubezzi-MSFT to no avail)

yonderTech commented 5 years ago

Same problem as ifexception above. 2.1.4-050276f1. Upgraded from 1.22

Cannot open web UI on port 8081. No other processes are using the port.

faldeland commented 5 years ago

Just installed 2.1.4.0 and get same error. This site can’t be reached The connection was reset. Try:

Checking the connection Checking the proxy and the firewall Running Windows Network Diagnostics ERR_CONNECTION_RESET

Ran as administrator and it prompted for /NoFirewall arg. Still no access to Data Explorer. Re-installing Azure VS tools/sdks.

Will report back. No Luck :(

Event logs show this error... Application: Microsoft.Azure.Cosmos.ComputeServiceStartupEntryPoint.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Security.AccessControl.PrivilegeNotHeldException at System.Security.AccessControl.Privilege.ToggleState(Boolean) at System.Security.Cryptography.Utils.GetKeySetSecurityInfo(System.Security.Cryptography.SafeProvHandle, System.Security.AccessControl.AccessControlSections) at System.Security.Cryptography.CspKeyContainerInfo.get_CryptoKeySecurity() at Microsoft.Azure.Documents.Common.CertificateUtil.SetCertificateAcl(System.Security.Cryptography.X509Certificates.X509Certificate2, System.String, Boolean) at Microsoft.Azure.CosmosDB.ServiceStartupEntryPoint.ServiceStartupEntryPoint.CosmosDBGatewayInit(System.Fabric.CodePackageActivationContext) at Microsoft.Azure.CosmosDB.ServiceStartupEntryPoint.ServiceStartupEntryPoint.Main(System.String[])

faldeland commented 5 years ago

I uninstalled the application. Deleted the program files remnants...that took some effort. Re-installed. All is working now.

Key piece was to completely delete the remnants of C:\Program Files\Azure Cosmos DB Emulator

RobinHSanner commented 5 years ago

I get this when I try to open the data explorer (note usually when you start cosmos it does this automatically but once this problem started it never appears to get to that point) and I'm on version 2.4.5.0

Failed to get authorization headers for offers: {"readyState":4,"responseText":"{\"code\":\"InternalServerError\",\"message\":\"Service is currently unavailable, please retry after a while. If this problem persists please contact support.\r\nActivityId: 9ab400c2-048d-43e3-9b44-1b13ebce92de, Microsoft.Azure.Documents.Common/2.4.0.0\"}","responseJSON":{"code":"InternalServerError","message":"Service is currently unavailable, please retry after a while. If this problem persists please contact support.\r\nActivityId: 9ab400c2-048d-43e3-9b44-1b13ebce92de, Microsoft.Azure.Documents.Common/2.4.0.0"},"status":500,"statusText":"error"}

RobinHSanner commented 5 years ago

stopping the process and deleting %LOCALAPPDATA%\CosmosDBEmulator resolved the issue

Mike-Ubezzi-MSFT commented 5 years ago

Additional troubleshooting steps can be found here.

justinbhopper commented 4 years ago

As @faldeland suggested, uninstalling and then deleting the remaining folder/files of "C:\Program Files\Azure Cosmos DB Emulator" fixed the issue for me.