Skip to content

Commit

Permalink
Document ShutdownDelay (#32637)
Browse files Browse the repository at this point in the history
* Document ShutdownDelay

* fix capitalization

* Apply suggestions from code review

Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>

* Update aspnetcore/host-and-deploy/iis/advanced.md

---------

Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
  • Loading branch information
tdykstra and Rick-Anderson committed May 23, 2024
1 parent 22c325b commit ff0729e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions aspnetcore/host-and-deploy/iis/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ The `disallowRotationOnConfigChange` setting is intended for blue/green scenario

This setting corresponds to the API <xref:Microsoft.Web.Administration.ApplicationPoolRecycling.DisallowRotationOnConfigChange?displayProperty=nameWithType>

## Reduce 503 likelihood during app recycle

By default there is a one second delay between when IIS is notified of a recycle or shutdown and when ANCM tells the managed server to initiate shutdown. The delay is configurable via the `ANCM_shutdownDelay` environment variable or by setting the `shutdownDelay` handler setting. Both values are in milliseconds. The delay is primarily to reduce the likelihood of a race where:

* IIS hasn't started queuing requests to go to the new app.
* ANCM starts rejecting new requests that come into the old app.

This setting doesn't mean incoming requests will be delayed by this amount. The setting indicates that the old app instance will start shutting down after the timeout occurs. Slower machines or machines with heavier CPU usage might need to adjust this value to reduce 503 likelihood.

The following example sets the delay to 5 seconds:

```xml
<aspNetCore processPath="dotnet"
arguments=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile="\\?\%home%\LogFiles\stdout"
hostingModel="inprocess">
<handlerSettings>
<handlerSetting name="shutdownDelay" value="5000" />
</handlerSettings>
</aspNetCore>
```

## Proxy configuration uses HTTP protocol and a pairing token

*Only applies to out-of-process hosting.*
Expand Down

0 comments on commit ff0729e

Please sign in to comment.