Search code examples
node.jsiisiisnode

iisnode not restarting/updating Node.js on file changes


Using iisnode and whenever I change a .js or .hbs (handlebars) file the Node.js app does not restart to update the changes. But if I change my web.config file then it does update.

This is basically what I have in my web.config file. I also updated the iisnode.yml file to be the same (but I don't understand why I can't just have the web.config file do everything... why have 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>

Why does iisnode only refresh the node.js server when I update web.config and not any other file?


Solution

  • Based on Brando's comment I fixed it by doing this:

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

    That line specifies which folders, other than the root folder, that you want iisnode to watch files for changes.