我正在尝试在 Azure Webapp 上运行一个 exe 文件来自 nodejs 服务器。该 exe 是由一个简单的 python 文件创建的 PyInstaller .
var exec = require('child_process').exec;
let cmd = 'hello.exe';
let child = exec(
cmd, {
cwd: path_to_exe_file
},
function(error, stdout, stderr) {
if (error === null) {
res.render('index', { title: stdout });
} else {
console.log(error);
res.json({
'status': '400',
'res': error
});
}
}
);
在我的机器上一切正常,但是当我部署到 Azure webapp 时出现错误:应用程序启动失败 因为它的并排配置不正确
Error: Command failed: hello.exe The application has failed to start
because its side-by-side configuration is incorrect.
Please see the application event log or use the command-line sxstrace.exe
tool for more detail.
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) killed: false, code: 1, signal: null, cmd: 'hello.exe' }
我该如何解决这个问题?谢谢
请您参考如下方法:
Yes, the problem due to pyinstaller. How about .Net exe file, can I run .Net exe file in nodejs script on Azure Web Apps?
是的,基本上我们可以。它也适用于我的测试项目,使用最简单的 .NET 控制台 exe。
但是有几点我们需要注意,Azure Web App env作为一个sanbox,有几个严格的限制和局限,并不是所有的.NET exe应用程序都可以在Azure Web Apps上执行。更多详情,可以引用https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox .
另外,根据你的场景,你可以尝试考虑使用WebJobs运行一些 exe 应用程序或任务。
