【问题标题】:Child Process won't spawn with iisnode子进程不会使用 iisnode 生成
【发布时间】:2017-12-10 05:07:34
【问题描述】:

我有一个在 Windows Server 上运行的 MEAN (Angular 2) 应用程序。 我在服务器上使用 iisnode 运行我的应用程序。 该应用程序运行良好,但有时我尝试使用节点(powershell.exe)生成一个子进程。在本地一切正常(powershell 脚本成功执行),但是当我从服务器 URL 测试它时,子进程永远不会产生。 我没有任何错误消息,该应用程序只是有点暂停。 当我使用“node server.js”从命令提示符运行 node.js 并转到:http://myserver.com:9000 时,应用程序运行良好,子进程成功生成。

我试过放powershell.exe的绝对路径,但是也没用。

localhost:9000 : 应用工作,子进程生成 ans 工作正常

myserver.com:9000 :应用工作正常,子进程生成 ans 工作正常

myserver.com/:应用程序正常,子进程不会产生,没有错误消息

这是我的 web.config 文件:

<configuration>
   <system.webServer>
     <!-- indicates that the hello.js file is a node.js application 
     to be handled by the iisnode module -->
     <handlers>
       <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
     </handlers>     
     <rewrite>
       <rules>
         <rule name="server">
           <match url="/*" />
           <action type="Rewrite" url="server.js" />
         </rule>
       </rules>
     </rewrite>
   </system.webServer>
 </configuration>

这是我生成子进程的route .js

child = spawn("powershell.exe",[`some commands`]);
child.stdout.on("data",function(data){
  console.log("Powershell Data: " + data);
});
child.stderr.on("data",function(data){
  console.log("Powershell Errors: " + data);
});
child.on("exit",function(){
  console.log("Powershell Script finished");
  //some other commands
});
child.stdin.end();

【问题讨论】:

    标签: node.js powershell child-process windows-server iisnode


    【解决方案1】:

    最后,powershell.exe 似乎正确生成。 但是,powershell 脚本应该打开 Powerpoint 并在其中执行一些操作。那部分不起作用,powershell会引发这个错误:

    Insufficient memory to continue the execution of the program

    这已通过修改 DCOM 配置解决,如下所示:How to deploy COM object Microsoft.Office.Interop to IIS so that my C# WCF service reference will work?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      • 2015-07-22
      • 2015-10-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多