在WebMatrix中运行节点应用程序时出错 [英] Error running node app in WebMatrix

查看:118
本文介绍了在WebMatrix中运行节点应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I installed WebMatrix and followed these instructions to install IIS 7 on my Windows 7 machine.

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

When I click 'Run' to run my express node app, the browser pops up and tells me

iisnode模块无法启动node.exe进程.确保在 system.webServer/iisnode/@nodeProcessCommandLine 元素.默认情况下,预期将node.exe安装在x86系统上的%ProgramFiles%\ nodejs文件夹中,以及x64系统上的%ProgramFiles(x86)%\ nodejs文件夹中.

The iisnode module is unable to start the node.exe process. Make sure the node.exe executable is available at the location specified in the system.webServer/iisnode/@nodeProcessCommandLine element of web.config. By default node.exe is expected to be installed in %ProgramFiles%\nodejs folder on x86 systems and %ProgramFiles(x86)%\nodejs folder on x64 systems.

这是我的web.config:

Here is my 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>

是什么原因导致此问题,以及如何解决?

推荐答案

如果您从网站上安装了x64版本的node,则这是一个常见问题.当前,IISNode已设置为从x32路径读取node.exe.您可以将nodeProcessCommandLine更改为使用盒子上node.exe的完整路径,也可以安装32位节点安装.我们正在努力解决此问题,以便32/64位都可以立即使用.让我知道这是否不是问题所在:)

This is a common problem if you've installed the x64 version of node from the website. Currently IISNode is set up to read node.exe from the x32 path. You can either change nodeProcessCommandLine to use the full path to node.exe on your box, or install the 32 bit node install. We're working on fixing this so both 32/64 bit will work out of the box. Let me know if this turns out to not be the problem :)

这篇关于在WebMatrix中运行节点应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆