# 错误：1053 (ERROR_SERVICE_REQUEST_TIMEOUT) - 服务未及时响应启动或控制请求。

- **ID:** `mongodb/invalid-windows-service-name`
- **领域:** mongodb
- **类别:** runtime_error
- **错误码:** `1053`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

Windows 上的 MongoDB 作为服务启动时未能在默认的 30 秒超时内启动，通常是由于配置文件损坏、系统资源不足或端口冲突。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| MongoDB 5.0 | active | — | — |
| MongoDB 6.0 | active | — | — |
| Windows Server 2019 | active | — | — |
| Windows Server 2022 | active | — | — |

## 解决方案

1. ```
   检查 MongoDB 日志文件（例如 C:\Program Files\MongoDB\Server\6.0\log\mongod.log）以获取具体错误。常见修复：使用 `netstat -ano | findstr :27017` 确保端口 27017 未被占用，或更正服务中的配置文件路径。
   ```
2. ```
   删除并重新创建 MongoDB 服务，使用显式参数：`sc delete MongoDB` 然后 `mongod.exe --config "C:\Program Files\MongoDB\Server\6.0\bin\mongod.cfg" --install --serviceName MongoDB`。
   ```
3. ```
   通过注册表临时增加服务启动超时时间（HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control, ServicesPipeTimeout = 60000）以允许更多启动时间，然后诊断日志。
   ```

## 无效尝试

- **** — The service will eventually time out again if the root issue (e.g., port conflict or corrupt config) is not addressed. (85% 失败率)
- **** — The same configuration file or port conflict remains, causing the same timeout. (90% 失败率)
- **** — This bypasses the service manager but leaves the system without automatic restart on boot, and may miss environment-specific settings. (70% 失败率)
