Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update making-aspnet-app-always-running.rst #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions deployment-to-production/making-aspnet-app-always-running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,13 @@ Follow these directions in IIS:

1. Set application pool under which the application runs to:

a. .NET CLR version: **.NET CLR Version v4.0.30319**
i. Normally, for a .NET Core app, you'd use *No managed code*, but if you do that, the application preload option won't work.
a. .NET CLR version: **No managed code**
b. Managed pipeline mode: **Integrated**

2. Right-click on the same application pool and select “Advanced Settings”. Update the following values:

a. Set start mode to “Always Running”.
i. Setting the start mode to “Always Running” tells IIS to start a worker process for your application right away, without waiting for the initial request.
b. Set Idle Time-Out (minutes) to 0.

.. image:: iis-pool-setting.png

Expand All @@ -209,12 +207,35 @@ Follow these directions in IIS:

.. image:: iis-preload-enabled.png

5. Go to the *Configuration Editor* on your app, and navigate to *system.webServer/applicationInitialization*. Set the following settings:
5. You will need to set the application initialization settings. There are two ways to do this.

a. doAppInitAfterRestart: **True**
b. Open up the *Collection...* ellipsis. On the next window, click *Add* and enter the following:
i. hostName: **{URL host for your Hangfire application}**
ii. initializationPage: **{path for your Hangfire dashboard, like /hangfire}**
a. First make sure the application initialization module is installed for IIS.
b. To make changes to your settings directly in IIS:

i. Go to the *Configuration Editor* on your app, and navigate to *system.webServer/applicationInitialization*.
ii. doAppInitAfterRestart: **True**
iii. Open up the *Collection...* ellipsis. On the next window, click *Add* and enter the following:

a) hostName: **{URL host for your Hangfire application}**
b) initializationPage: **{path for your Hangfire dashboard, like /hangfire}**

c. Alternatively to ii. above, you can make these changes directly in your web.config file:

.. code-block:: xml

<system.webServer>
<applicationInitialization doAppInitAfterRestart="true">
<clear />
<add initializationPage="**{path for your Hangfire dashboard, like /hangfire}**" hostName="**{URL host for your Hangfire application}**" />
</applicationInitialization>
</system.webServer>

6. There is `currently a bug <https://github.com/dotnet/aspnetcore/issues/19509>` in .NET Core affecting garbage collection. To get around this, you must add the following to your .csproj file:

.. code-block:: xml

You can check `this page for more documentation about it <https://www.taithienbo.com/how-to-auto-start-and-keep-an-asp-net-core-web-application-and-keep-it-running-on-iis/>`_.
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>
</PropertyGroup>