2012-10-26 24 views
6

Tôi đã cài đặt WebMatrix và theo sau these hướng dẫn cài đặt IIS 7 trên máy tính Windows 7 của tôi.Lỗi khi chạy ứng dụng nút trong WebMatrix

Khi tôi nhấp vào 'Run' để chạy ứng dụng nút nhanh của tôi, trình duyệt bật lên và nói với tôi

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.

Đây là web.config của tôi:

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

gì đang gây ra này vấn đề, và làm thế nào để sửa nó?

Trả lời

10

Đây là vấn đề phổ biến nếu bạn đã cài đặt phiên bản x64 của nút từ trang web. Hiện tại IISNode được thiết lập để đọc node.exe từ đường dẫn x32. Bạn có thể thay đổi nodeProcessCommandLine để sử dụng đường dẫn đầy đủ đến node.exe trên hộp của bạn, hoặc cài đặt nút cài đặt 32 bit. Chúng tôi đang cố gắng khắc phục điều này để cả 32/64 bit sẽ hoạt động. Hãy cho tôi biết nếu điều này hóa ra không phải là vấn đề :)

+1

Là '" "% programfiles% \ nodejs \ node.exe " "" không phải là đường dẫn đầy đủ? –

+1

Tôi đã cài đặt phiên bản 32 bit và có - nó đang hoạt động ngay bây giờ. Cảm ơn rất nhiều Justin. –

+2

Tôi đã có cùng một vấn đề và áp dụng tất cả các bản sửa lỗi (cài đặt x86 hoặc chỉnh sửa web.config hoặc đặt một liên kết tượng trưng) được đề xuất ở đây và các địa điểm khác không có kết quả. Nó chỉ ra rằng sau khi bạn áp dụng các bản sửa lỗi này, bạn cũng phải khởi động lại WAS bằng các lệnh sau từ Powershell hoặc Command Prompt: "net stop" & "net start w3svc" Sau khi tôi chạy các lệnh đó. Tôi tìm thấy điều này trên trang vấn đề cho lỗi cụ thể này: https://github.com/tjanczuk/iisnode/issues/302 – Conor

21

với Node.js (64-bit), hãy thử đặt này ở dưới cùng của web.config

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

Điều này làm việc cho tôi - cảm ơn – markbarton

+0

Điều này đã giúp tôi. Biến môi trường '% ProgamFiles%' dường như không mở rộng. Hardcoding giá trị trong đó làm việc. –

+0

cảm ơn thông tin, hoạt động như một sự quyến rũ! –

6

Thay vì cài đặt 32 phiên bản -bit, bạn có thể tạo một liên kết tượng trưng từ đường dẫn 32 bit đến đường dẫn 64 bit.

Tại cmd.exe nhắc:

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

ngạc nhiên rằng điều này vẫn chưa được khắc phục và thiết lập web.config dường như bị bỏ qua.

Các vấn đề liên quan