2012-10-26 38 views
6

我安裝了WebMatrix並遵循these指令在我的Windows 7機器上安裝IIS 7。在WebMatrix中運行節點應用程序時出錯

當我點擊「運行」來運行我的快遞節點的應用程序,瀏覽器彈出,並告訴我

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:

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

是什麼原因造成問題,我該如何解決它?

回答

10

如果您已經從網站安裝了x64版本的節點,這是一個常見問題。目前IISNode已設置爲從x32路徑讀取node.exe。您可以更改nodeProcessCommandLine以在您的盒子上使用node.exe的完整路徑,也可以安裝32位節點安裝。我們正在努力解決這個問題,以便32/64位可以開箱即用。讓我知道這原來不是問題:)

+1

是''"%programfiles%\ nodejs \ node.exe "「'不是完整路徑? –

+1

我安裝了32位版本,是的 - 它現在正在工作。非常感謝Justin。 –

+2

我有同樣的問題,並應用所有修復(安裝x86或編輯web.config或放置符號鏈接)在這裏建議和其他地方沒有用。事實證明,應用這些修補程序後,您還必須重新啓動與PowerShell的或命令提示符下鍵入以下命令WAS: 「網站是」&「NET START W3SVC」 一次我跑這些命令的修復工作。我在問題頁面上發現了這個具體錯誤:https://github.com/tjanczuk/iisnode/issues/302 – Conor

21

與node.js中(64位),嘗試web.config文件的底部放置此

<iisnode watchedFiles="*.js;node_modules\*;routes\*.js;views\*.jade" 
nodeProcessCommandLine="\program files\nodejs\node.exe"/> 
+2

這對我有用 - 謝謝 – markbarton

+0

這也幫助了我。 '%ProgamFiles%'環境變量似乎沒有擴展。對那裏的價值進行硬編碼。 –

+0

感謝您的信息,工作就像一個魅力! –

6

,而不必安裝32位版本,您可以創建從32位路徑到64位路徑的符號鏈接。

cmd.exe提示:

mklink /D "C:\Program Files (x86)\nodejs" "C:\Program Files\nodejs" 

令人詫異的是,這仍然是不固定的,web.config設置似乎被忽略。

相關問題