首页 > 解决方案 > iisnode 不会在文件更改时重新启动/更新 Node.js

问题描述

使用 iisnode 并且每当我更改.js或更改.hbs (handlebars)文件时,Node.js 应用程序都不会重新启动以更新更改。但是,如果我更改我的web.config文件,那么它确实会更新。

这基本上就是我web.config文件中的内容。我还将 iisnode.yml 文件更新为相同(但我不明白为什么我不能让 web.config 文件做所有事情......为什么有 iisnode.yml?)

<configuration>
<system.webServer>
....
<!-- rewrite rules and handler appears here --->

<iisnode
              node_env="%node_env%"
              nodeProcessCountPerApplication="1"
              maxConcurrentRequestsPerProcess="1024"
              maxNamedPipeConnectionRetry="100"
              namedPipeConnectionRetryDelay="250"
              maxNamedPipeConnectionPoolSize="512"
              maxNamedPipePooledConnectionAge="30000"
              asyncCompletionThreadCount="0"
              initialRequestBufferSize="4096"
              maxRequestBufferSize="65536"
              watchedFiles="*;*.hbs;web.config;*.js" <!-- told it to watch everything -->
              uncFileChangesPollingInterval="5"      <!--- very low polling interval -->
              gracefulShutdownTimeout="60000"
              loggingEnabled="true"
              logDirectory="iisnode"
              debuggingEnabled="true"
              debugHeaderEnabled="false"
              debuggerPortRange="5058-6058"
              debuggerPathSegment="debug"
              maxLogFileSizeInKB="128"
              maxTotalLogFileSizeInKB="1024"
              maxLogFiles="20"
              devErrorsEnabled="true"
              flushResponse="false"
              enableXFF="false"
              promoteServerVars=""
              configOverrides="iisnode.yml"
             />
    </system.webServer>
</configuration>

为什么iisnode在我更新时只刷新node.js服务器而不刷新web.config任何其他文件?

标签: node.jsiisiisnode

解决方案


根据白兰度的评论,我通过这样做修复了它:

watchedFiles="*.js;*.hbs;web.config;routes\*;views\*;controllers\*;models\*"

该行指定除根文件夹之外的哪些文件夹,您希望 iisnode 监视文件的更改。


推荐阅读