2017-05-05 20 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應用程序或任務。