There are several configuration options that can be controlled from the system.webServer/iisnode - section of the configurtion file. Review web.config below for detailed description + section of the web.config configurtion file or the node.config file. Review web.config or node.config below for detailed description of them.
visit the node.js endpoint at hello.jscode
var http = require('http'); @@ -130,6 +131,14 @@ console.log('Application started at location ' + process.env.PORT);x-iisnode-<server_variable_name> HTTP request headers; for a list of IIS server variables available see http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" + * configOverrides - optional file name containing overrides of configuration settings of the iisnode section of web.config; + the format of the file is a small subset of YAML: each setting is represented as a <key>: <value> on a separate line + and comments start with # until the end of the line, e.g. + # This is a sample node.config file + nodeProcessCountPerApplication: 2 + maxRequestBufferSize: 8192 # increasing from the default + # maxConcurrentRequestsPerProcess: 512 - commented out setting + --> <iisnode @@ -143,7 +152,7 @@ console.log('Application started at location ' + process.env.PORT); asyncCompletionThreadCount="0" initialRequestBufferSize="4096" maxRequestBufferSize="65536" - watchedFiles="*.js" + watchedFiles="*.js;node.conf" uncFileChangesPollingInterval="5000" gracefulShutdownTimeout="60000" loggingEnabled="true" @@ -157,6 +166,7 @@ console.log('Application started at location ' + process.env.PORT); flushResponse="false" enableXFF="false" promoteServerVars="" + configOverrides="node.conf" /> <!-- @@ -171,5 +181,145 @@ console.log('Application started at location ' + process.env.PORT); </system.webServer> </configuration> +
+ node.config
+# The optional node.config file provides overrides of the iisnode configuration settings specified in web.config. + +# node_env - determines the environment (production, development, staging, ...) in which +# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV +# environment variable; the default is the value of the IIS worker process'es NODE_ENV +# environment variable + +node_env: %node_env% + +# nodeProcessCommandLine - command line starting the node executable; in shared +# hosting environments this setting would typically be locked at the machine scope. + +# nodeProcessCommandLine: "%programfiles%\nodejs\node.exe" + +# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; +# setting this value to 0 results in creating one node.exe process per each processor on the machine + +nodeProcessCountPerApplication: 1 + +# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can +# handle at a time + +maxConcurrentRequestsPerProcess: 1024 + +# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a +# node process in order to send a new HTTP request + +maxNamedPipeConnectionRetry: 24 + +# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries + +namedPipeConnectionRetryDelay: 250 + +# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; +# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests + +maxNamedPipeConnectionPoolSize: 512 + +# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for +# subsequent requests + +maxNamedPipePooledConnectionAge: 30000 + +# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it +# to 0 (default) results in creating one thread per each processor on the machine + +asyncCompletionThreadCount: 0 + +# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request + +initialRequestBufferSize: 4096 + +# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of +# the serialized form of HTTP request or response headers block + +maxRequestBufferSize: 65536 + +# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; +# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point +# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" + +watchedFiles: *.js;node.config + +# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides +# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting +# controls the polling interval + +uncFileChangesPollingInterval: 5000 + +# gracefulShutdownTimeout - when a node.js file is modified, all node processes handling running this application are recycled; +# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the +# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version +# of the application + +gracefulShutdownTimeout: 60000 + +# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP + +loggingEnabled: true + +# logDirectoryNameSuffix - suffix of the directory name that will store files with stdout and stderr captures; directly name is created +# by appending this suffix to the file name of the node.js application; individual log files are stored in that directory, one per node +# process (in files of the form x.txt, where x is between 0 and nodeProcessCountPerApplication - 1); given a node.js application at +# http://localhost/node/hello.js, log files would by default be stored at http://localhost/node/hello.js.logs/0.txt (thrugh 3.txt); +# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered +# cryptographically secure; in most situations, a GUID is sufficient + +logDirectoryNameSuffix: logs + +# debuggingEnabled - controls whether the built-in debugger is available + +debuggingEnabled: true + +# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode +# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range + +debuggerPortRange: 5058-6058 + +# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a node.js application at +http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default +http://foo.com/bar/baz.js/debug + +debuggerPathSegment: debug + +# maxLogFileSizeInKB - maximum size of a log file in KB; once a log file exceeds this limit it is truncated back to empty + +maxLogFileSizeInKB: 128 + +# appendToExistingLog - determines whether pre-existing log files are appended to or created fresh when a node process with a given ordinal +# number starts; appending may be useful to diagnose unorderly node process terminations or recycling + +appendToExistingLog: false + +# logFileFlushInterval - interval in milliseconds for flushing logs to the log files + +logFileFlushInterval: 5000 + +# devErrorsEnabled - controls how much information is sent back in the HTTP response to the browser when an error occurrs in iisnode; +# when true, error conditions in iisnode result in HTTP 200 response with the body containing error details; when false, +# iisnode will return generic HTTP 5xx responses + +devErrorsEnabled: true + +# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs +# CPU cost but may improve latency in streaming scenarios + +flushResponse: false + +# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host + +enableXFF: false + +# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of +# x-iisnode-<server_variable_name> +# HTTP request headers; for a list of IIS server variables available see +# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" + +promoteServerVars: