DocumentDB 模拟器作为 Windows 服务

DocumentDB Emulator as a Windows Service

我正在尝试 运行 DocumentDB Emulator 作为 windows 服务使用 sc 实用程序,该端口与它尝试使用的默认端口 8081 不同。

sc create DocumentDBEmulatorService binPath= "path\to\exe\DocumentDB.Emulator.exe /port=8082" start= auto

服务已创建但无法启动并显示以下错误消息

The DocumentDBEmulatorService service failed to start due to the following error.The DocumentDBEmulatorService did not respond to the start or control request in a timely fashion. A timeout was reached (30000 milliseconds) while waiting for DocumentDBEmulatorService service to connect.

是否可以 运行 将 DB 模拟器可执行文件记录为服务,或者我正在尝试做一些显然不可能的事情?

sc 只会 运行 一个可执行文件,它是一个适当的 Windows 服务(即实现 ServiceMain)。

您可以尝试 NSSM 之类的方法。

查看 this question 中的答案(已接受的答案除外)以获得更多选项。