在WebMatrix中运行节点应用程序时出错

Sco*_*ler 6 runtime-error node.js webmatrix webmatrix-2

我安装了WebMatrix并按照这些说明在我的Windows 7计算机上安装IIS 7.

当我单击"运行"以运行我的快速节点应用程序时,浏览器会弹出并告诉我

iisnode模块无法启动node.exe进程.确保node.exe可执行文件在web.config 的system.webServer/iisnode/@nodeProcessCommandLine元素中指定的位置可用.默认情况下,node.exe应安装在x86系统上的%ProgramFiles%\nodejs文件夹和x64系统上的%ProgramFiles(x86)%\nodejs文件夹中.

这是我的web.config:

<configuration>
<system.webServer>

<handlers>
  <!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
  <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>

<rewrite>
  <rules>
    <!-- Don't interfere with requests for logs -->
    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
    </rule>

    <!-- Don't interfere with requests for node-inspector debugging -->
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^app.js\/debug[\/]?" />
    </rule>

    <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}" />
    </rule>

    <!-- All other URLs are mapped to the Node.js application entry point -->
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
      </conditions>
      <action type="Rewrite" url="app.js" />
    </rule>
  </rules>
</rewrite>

<!-- You can control how Node is hosted within IIS using the following options -->
<!--<iisnode      
      node_env="%node_env%"
      nodeProcessCountPerApplication="1"
      maxConcurrentRequestsPerProcess="1024"
      maxNamedPipeConnectionRetry="3"
      namedPipeConnectionRetryDelay="2000"      
      maxNamedPipeConnectionPoolSize="512"
      maxNamedPipePooledConnectionAge="30000"
      asyncCompletionThreadCount="0"
      initialRequestBufferSize="4096"
      maxRequestBufferSize="65536"
      watchedFiles="*.js"
      uncFileChangesPollingInterval="5000"      
      gracefulShutdownTimeout="60000"
      loggingEnabled="true"
      logDirectoryNameSuffix="logs"
      debuggingEnabled="true"
      debuggerPortRange="5058-6058"
      debuggerPathSegment="debug"
      maxLogFileSizeInKB="128"
      appendToExistingLog="false"
      logFileFlushInterval="5000"
      devErrorsEnabled="true"
      flushResponse="false"      
      enableXFF="false"
      promoteServerVars=""
     />-->

  <iisnode     
    nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;"
    interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" 
  />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

是什么导致了这个问题,我该如何解决?

小智 21

使用node.js(64位),尝试将其放在web.config的底部

<iisnode watchedFiles="*.js;node_modules\*;routes\*.js;views\*.jade" 
nodeProcessCommandLine="\program files\nodejs\node.exe"/>
Run Code Online (Sandbox Code Playgroud)


Jus*_*ith 10

如果您已从网站安装x64版本的节点,则这是一个常见问题.目前,IISNode设置为从x32路径读取node.exe.您可以更改nodeProcessCommandLine以使用包装盒上的node.exe的完整路径,也可以安装32位节点安装.我们正在努力解决这个问题,因此32/64位都可以开箱即用.如果事实证明这不是问题,请告诉我:)

  • 我有同样的问题并应用了所有修复(安装x86或编辑web.config或放置符号链接)建议在这里和其他地方无济于事.事实证明,在应用这些修补程序后,您还必须使用Powershell或命令提示符中的以下命令重新启动WAS:"net stop was"和"net start w3svc"一旦我运行了这些命令,修复就会起作用.我在问题页面上发现了这个特定错误:https://github.com/tjanczuk/iisnode/issues/302 (2认同)

Joh*_*yHK 6

您可以创建从32位路径到64位路径的符号链接,而不是安装32位版本.

cmd.exe提示:

mklink /D "C:\Program Files (x86)\nodejs" "C:\Program Files\nodejs"
Run Code Online (Sandbox Code Playgroud)

令人惊讶的是,这仍然没有修复,web.config设置似乎被忽略了.