在MonsterASP部署NestJS应用遇502.5错误,求技术指导
求助:NestJS应用部署到MonsterASP平台遇到502.5错误
已完成操作
- 应用构建:开发完成NestJS应用后执行
npm run build,生成包含编译后JS文件的dist/目录。 - 启动脚本:在项目根目录创建
server.js文件,内容如下:
const { AppModule } = require('./dist/app.module'); const { NestFactory } = require('@nestjs/core'); async function bootstrap() { const app = await NestFactory.create(AppModule); await app.listen(process.env.PORT || 3000); } bootstrap();
- 配置文件:在
/wwwroot目录添加web.config文件,配置内容如下:
<configuration> <system.webServer> <handlers> <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" /> </handlers> <httpPlatform processPath="node" arguments=".\server.js" startupTimeLimit="20" stdoutLogEnabled="true" stdoutLogFile=".\logs\node"> <environmentVariables> <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" /> <environmentVariable name="NODE_ENV" value="production" /> </environmentVariables> </httpPlatform> </system.webServer> </configuration>
- 文件上传:将
dist/目录、server.js、package.json及web.config上传至MonsterASP的/wwwroot目录。
遇到的问题
访问应用时出现错误:HTTP Error 502.5 - Process Failure,提示应用进程启动失败或未监听配置端口。
求助内容
- 是否有人成功在MonsterASP部署过NestJS应用?
- 是否存在我遗漏的特定配置或步骤?
- 在MonsterASP上安装Node.js依赖(
node_modules)的推荐方法是什么?
希望能得到相关见解、建议或经验分享,感谢支持!
内容的提问来源于stack exchange,提问作者Mohamed Saeed bin Omar
相关产品推荐
相关产品推荐

