我正在尝试从nodejs服务器在Azure Webapp上运行exe文件。exe是由PyInstaller从一个简单的python文件创建的。
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' }
如何解决此问题?谢谢
是的,由于pyinstaller造成的问题。.Net exe文件如何,我可以在Azure Web Apps上的nodejs脚本中运行.Net exe文件吗?
是的,基本上可以。而且,在使用最简单的.NET控制台exe的我的测试项目中也可以使用。
但是,我们需要注意一些要点,Azure Web App env作为sanbox,存在一些严格的限制和限制,即并非所有.NET exe应用程序都可以在Azure Web Apps上执行。有关更多详细信息,可以参考https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox。
此外,根据您的方案,您可以尝试考虑使用WebJobs运行某些exe应用程序或任务。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句