Skip to content

IIS

--preset iis-node and --preset iis-handler are chosen by name only. Both are the node build, which serves its own public files, plus .output/web.config. Deploy .output/ as the site root.

Reference

Presetiis-node
Runs onIIS with the iisnode module
event.runtime.namenode
Server targetnode
Lifetime, startupprocess, load

Output

text
.output/
  web.config                 the handler, rules and httpPlatform, merged into yours
  server/index.mjs           the node entry
  server/index.cjs           a shim iisnode can require
  public/

Config keys

This preset has no key of its own.

Detection

None. Name it with --preset, preset in the config or HAMUR_PRESET; no environment variable selects it.

Deploy command

No hamur deploy command: it exits 1 for this preset. Deploy .output/ as the site root. iis-node and iis-handler share this page's text. hamur preview runs the built output with Hamur's own runner.

Limits

  • Runs: streamed answers, server.metrics, private app/env.ts entries read at run time.
  • Does not run: WebSockets and server.syncedState, server.pubsub, image transforms at run time, Durable Object classes.

The levels are the features of the preset: hamur build warns or fails when the app uses a feature the preset does not run (see Preset features).

iis-node maps server/index.cjs to the iisnode module. iisnode requires its entry, which cannot load the ES module server, so the build writes server/index.cjs, a small shim that imports index.mjs. iisnode passes PORT as a named pipe (\\.\pipe\...), and the node entry listens on it. Two URL Rewrite rules follow: hamur-public rewrites every URL to public/<url>, and hamur-server sends the request to the shim when that is not a file; iisnode hands the server the original URL.

iis-handler maps every path to HttpPlatformHandler, which runs node server\index.mjs with PORT set to %HTTP_PLATFORM_PORT%. Node must be on the PATH of the site's application pool. The server answers public files itself, so the config holds no rewrite rule.

A web.config in the project root is merged: its elements stay as written, and Hamur's handler, rules and httpPlatform are appended inside its <system.webServer> (after the rules it already has). A file that is not well-formed XML, whose root is not <configuration>, or that has more than one <system.webServer> fails the build, naming the element. A <httpPlatform> of your own is kept and Hamur's is not added.