2017-05-05 69 views
2

我试图从nodejs服务器上运行Azure Webapp上的exe文件。该exe文件由PyInstaller由简单的python文件创建。未能在Azure Webapp上运行EXE文件

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的web应用原来的错误:应用程序未能启动, 因为它并排并排配置不正确

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' } 

我该如何解决这个问题?谢谢

+0

由于不太确切,Azure Web App包含python运行时,您仍然可以在Azure Web Apps上的node.js脚本中执行python脚本。这个问题应该归功于任何C++依赖关系'pyinstaller'的使用。因为我们没有权限处理Azure Web App上的C++组件。所以,如果可能的话,你可以尝试直接执行python脚本吗? –

+0

是的,由于pyinstaller的问题。 .Net exe文件怎么样,我可以在Azure Web Apps的nodejs脚本中运行.Net exe文件吗? –

回答

1

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应用程序或任务。