You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Cosmos DB Emulator启动停滞故障排查求助

Azure Cosmos DB Emulator启动失败:KeyNotFoundException故障排查与解决方案

问题概述

使用Azure Cosmos DB Emulator已满1年,这是第三次出现启动失败的情况,此前只能通过重装Windows 10解决问题。

系统配置

  • Windows 10 Pro
  • 拥有管理员权限
  • 已加入AAD域
  • 杀毒软件:ESET Endpoint antivirus 9.1.2051.0
  • CPU:Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz 3.40 GHz
  • 内存:32GB
  • 所有软件安装在C盘

已尝试的排查操作及结果

操作1:清除性能计数器后启动

执行命令:

Microsoft.Azure.Cosmos.Emulator.exe /shutdown
lodctr /R
lodctr /R
Microsoft.Azure.Cosmos.Emulator.exe

结果:

  • 弹出“Starting”提示框
  • 在AppData/Local/CrashDumps生成转储文件
  • 始终未显示“已启动”提示,管理网页无法访问

操作2:卸载重装最新版本

执行步骤:

Microsoft.Azure.Cosmos.Emulator.exe /shutdown
rmdir /s /q %LOCALAPPDATA%\CosmosDBEmulator
# 通过控制面板卸载Cosmos DB Emulator
rmdir /s /q "C:\Program Files\Azure Cosmos DB Emulator"
shutdown /r /t 0
# 安装最新版本:azure-cosmosdb-emulator-2.14.9-3c8bff92.msi

结果:与操作1完全一致,启动失败并生成转储文件

操作3:启用追踪后启动

执行命令:

Microsoft.Azure.Cosmos.Emulator.exe /shutdown
Microsoft.Azure.Cosmos.Emulator.exe /startwprtraces
Microsoft.Azure.Cosmos.Emulator.exe
# 等待1分钟
Microsoft.Azure.Cosmos.Emulator.exe /stopwprtraces
Microsoft.Azure.Cosmos.Emulator.exe /shutdown

结果:

  • 弹出“Starting”提示框
  • AppData/Local/CrashDumps每20-30秒生成一个转储文件
  • 执行停止追踪后,在C:\Program Files\Azure Cosmos DB Emulator生成docdbemulator_001.etl文件
  • 仍未显示“已启动”提示,管理网页无法访问

错误分析

WinDbg转储分析结果

CLR_EXCEPTION_System.Collections.Generic.KeyNotFoundException_80131577_Microsoft.Azure.Documents.Common.dll!Microsoft.Azure.Documents.Common.Service.WindowsFabricConfigurationProvider.GetValue

堆栈跟踪:

00000085`583feb40 00007ffe`49323302 Microsoft_Azure_Documents_Common!Microsoft.Azure.Documents.Common.Service.WindowsFabricConfigurationProvider.GetValue+0x52
00000085`583feb80 00007ffe`493230cb Microsoft_Azure_Documents_Common!Microsoft.Azure.Documents.Common.CrashDump.Register+0xdb
00000085`583febf0 00007ffe`48f673ee Microsoft_Azure_Cosmos_Compute_Host_ServiceFabric_EntryPoint!Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.EntryPoint.CosmosDBGatewayInit+0x56e
00000085`583fecf0 00007ffe`48f51465 Microsoft_Azure_Cosmos_Compute_Host_ServiceFabric_EntryPoint!Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.EntryPoint.Main+0x295

Windows事件日志错误(法语转译后)

应用程序:Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.exe
.NET Framework版本:v4.0.30319
描述:进程因未处理的异常终止。
异常信息:System.Collections.Generic.KeyNotFoundException
在 Microsoft.Azure.Documents.Common.Service.WindowsFabricConfigurationProvider.GetValue(System.String)
在 Microsoft.Azure.Documents.Common.CrashDump.Register(System.Collections.Generic.IEnumerable`1<System.String>, Microsoft.Azure.Cosmos.Core.IConfigurationProvider)
在 Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.EntryPoint.CosmosDBGatewayInit(System.Fabric.CodePackageActivationContext, System.String)
在 Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.EntryPoint.Main(System.String[])

另一条日志详情:

Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.exe
            2.14.0.0
            bc4d0da5
            KERNELBASE.dll
            10.0.19041.1889
            e9ede6d6
            e0434352
            0000000000034fd9
            4360
            01d8b7ac99b3d711
            C:\Program Files\Azure Cosmos DB Emulator\Packages\CosmosGatewayService\CosmosGatewayService.Code\EP\Microsoft.Azure.Cosmos.Compute.Host.ServiceFabric.EntryPoint.exe
            C:\WINDOWS\System32\KERNELBASE.dll
            01134c47-5efa-4d7a-a243-15af35536df0

针对性解决方案建议

1. 检查Service Fabric配置文件完整性

错误指向WindowsFabricConfigurationProvider.GetValue未找到对应配置键,说明Emulator依赖的Service Fabric配置可能损坏:

  • 打开C:\Program Files\Azure Cosmos DB Emulator\Packages目录,检查CosmosGatewayService等包内的Settings.xml文件是否存在且配置项完整
  • 若文件损坏,从正常运行的同版本Emulator中复制对应配置文件替换

2. 临时禁用杀毒软件测试

ESET Endpoint Antivirus可能误拦截Emulator进程:

  • 临时关闭ESET实时防护功能
  • 以管理员身份重新启动Emulator
  • 若启动成功,将C:\Program Files\Azure Cosmos DB Emulator和%LOCALAPPDATA%\CosmosDBEmulator添加到ESET信任列表

3. 重置Service Fabric本地集群

Emulator基于Service Fabric运行,重置集群可修复配置异常:

# 关闭Emulator
Microsoft.Azure.Cosmos.Emulator.exe /shutdown
# 重置Service Fabric本地集群(脚本位于Emulator安装目录的ServiceFabric子文件夹)
.\ServiceFabric\ClusterSetup\DevClusterSetup.ps1 -Reset
# 重新启动Emulator
Microsoft.Azure.Cosmos.Emulator.exe

4. 排查域组策略限制

已加入AAD域可能存在策略限制:

  • 联系域管理员,检查是否有策略限制Service Fabric相关进程的权限
  • 确认是否禁止修改本地配置文件或注册表项

5. 回退到旧版本Emulator

最新版本可能存在兼容性问题:

  • 卸载当前版本,安装之前能正常运行的稳定版本(如2.13.x系列)
  • 启动后验证是否恢复正常

内容的提问来源于stack exchange,提问作者Dadv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 19:15:32