You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This topic describes the most common errors and provides troubleshooting advice when hosting ASP.NET Core apps on Azure Apps Service and IIS.
17
+
This article describes the most common errors and provides troubleshooting advice when hosting ASP.NET Core apps on Azure Apps Service and IIS.
18
18
19
19
See <xref:test/troubleshoot-azure-iis> information on common app startup errors and instructions on how to diagnose errors.
20
20
21
21
Collect the following information:
22
22
23
23
* Browser behavior such as status code and error message.
24
-
* Application Event Log entries
24
+
* Application Event Log entries.
25
25
* Azure App Service: See <xref:test/troubleshoot-azure-iis>.
26
26
* IIS
27
27
1. Select **Start** on the **Windows** menu, type *Event Viewer*, and press **Enter**.
28
28
1. After the **Event Viewer** opens, expand **Windows Logs** > **Application** in the sidebar.
29
-
* ASP.NET Core Module stdout and debug log entries
29
+
* ASP.NET Core Module stdout and debug log entries.
30
30
* Azure App Service: See <xref:test/troubleshoot-azure-iis>.
31
-
* IIS: Follow the instructions in the [Log creation and redirection](xref:host-and-deploy/aspnet-core-module#log-creation-and-redirection) and [Enhanced diagnostic logs](xref:host-and-deploy/iis/logging-and-diagnostics#enhanced-diagnostic-logs) sections of the ASP.NET Core Module topic.
31
+
* IIS: Follow the instructions in the [Log creation and redirection](xref:host-and-deploy/aspnet-core-module#log-creation-and-redirection) and [Enhanced diagnostic logs](xref:host-and-deploy/iis/logging-and-diagnostics#enhanced-diagnostic-logs) sections of the ASP.NET Core Module article.
32
32
33
33
Compare error information to the following common errors. If a match is found, follow the troubleshooting advice.
34
34
35
-
The list of errors in this topic isn't exhaustive. If you encounter an error not listed here, open a new issue using the **Content feedback** button at the bottom of this topic with detailed instructions on how to reproduce the error.
35
+
The list of errors in this article isn't exhaustive. If you encounter an error not listed here, open a new issue using the **Content feedback** button at the bottom of this article with detailed instructions on how to reproduce the error.
36
36
37
37
[!INCLUDE[Azure App Service Preview Notice](~/includes/azure-apps-preview-notice.md)]
38
38
@@ -293,7 +293,7 @@ Troubleshooting:
293
293
294
294
The process failed to start, most likely due to an app configuration or programming issue.
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/iis/advanced.md
+32-32Lines changed: 32 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Advanced configuration with the ASP.NET Core Module and Internet In
5
5
monikerRange: '>= aspnetcore-5.0'
6
6
ms.author: tdykstra
7
7
ms.custom: mvc, sfi-image-nochange
8
-
ms.date: 03/07/2025
8
+
ms.date: 04/21/2026
9
9
uid: host-and-deploy/iis/advanced
10
10
---
11
11
# Advanced configuration of the ASP.NET Core Module and IIS
@@ -34,7 +34,7 @@ Configure the managed stack size using the `stackSize` setting in hexadecimal by
34
34
35
35
## Disallow rotation on config
36
36
37
-
The `disallowRotationOnConfigChange` setting is intended for blue/green scenarios where a change to global config should not cause all sites to recycle. When this flag is true, only changes relevant to the site itself will cause it to recycle. For example, a site recycles if its *web.config* changes or something changes that is relevant to the site's path from IIS's perspective. But a general change to *applicationHost.config*would not cause an app to recycle. The following example sets this setting to true:
37
+
The `disallowRotationOnConfigChange` setting is intended for blue/green scenarios where a change to global config shouldn't cause all sites to recycle. When this flag is true, only changes relevant to the site itself will cause it to recycle. For example, a site recycles if its *web.config* changes or something changes that's relevant to the site's path from IIS's perspective. But a general change to *applicationHost.config*wouldn't cause an app to recycle. The following example sets this setting to true:
38
38
39
39
```xml
40
40
<aspNetCoreprocessPath="dotnet"
@@ -48,11 +48,11 @@ The `disallowRotationOnConfigChange` setting is intended for blue/green scenario
48
48
</aspNetCore>
49
49
```
50
50
51
-
This setting corresponds to the API <xref:Microsoft.Web.Administration.ApplicationPoolRecycling.DisallowRotationOnConfigChange?displayProperty=nameWithType>
51
+
This setting corresponds to the <xref:Microsoft.Web.Administration.ApplicationPoolRecycling.DisallowRotationOnConfigChange?displayProperty=nameWithType> API.
52
52
53
53
## Reduce 503 likelihood during app recycle
54
54
55
-
By default, there is a onesecond 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:
55
+
By default, there's 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:
56
56
57
57
* IIS hasn't started queuing requests to go to the new app.
58
58
* ANCM starts rejecting new requests that come into the old app.
@@ -104,9 +104,9 @@ The [ASP.NET Core Data Protection stack](xref:security/data-protection/introduct
104
104
105
105
If the Data Protection key ring is stored in memory when the app restarts:
106
106
107
-
* All cookie-based authentication tokens are invalidated.
108
-
* Users are required to sign in again on their next request.
109
-
* Any data protected with the key ring can no longer be decrypted. This may include [CSRF tokens](xref:security/anti-request-forgery#aspnet-core-antiforgery-configuration) and [ASP.NET Core MVC TempData cookies](xref:fundamentals/app-state#tempdata).
107
+
* All cookie-based authentication tokens are invalidated.
108
+
* Users are required to sign in again on their next request.
109
+
* Any data protected with the key ring can no longer be decrypted. This might include [CSRF tokens](xref:security/anti-request-forgery#aspnet-core-antiforgery-configuration) and [ASP.NET Core MVC TempData cookies](xref:fundamentals/app-state#tempdata).
110
110
111
111
To configure data protection under IIS to persist the key ring, use **one** of the following approaches:
112
112
@@ -144,7 +144,7 @@ To configure data protection under IIS to persist the key ring, use **one** of t
144
144
145
145
## IIS configuration
146
146
147
-
**Windows Server operating systems**
147
+
### Windows Server operating systems
148
148
149
149
Enable the **Web Server (IIS)** server role and establish role services.
150
150
@@ -164,7 +164,7 @@ Enable the **Web Server (IIS)** server role and establish role services.
164
164
165
165
1. Proceed through the **Confirmation** step to install the web server role and services. A server/IIS restart isn't required after installing the **Web Server (IIS)** role.
166
166
167
-
**Windows desktop operating systems**
167
+
### Windows desktop operating systems
168
168
169
169
Enable the **IIS Management Console** and **World Wide Web Services**.
170
170
@@ -196,7 +196,7 @@ Enable the **IIS Management Console** and **World Wide Web Services**.
196
196
197
197
An ASP.NET Core app can be hosted as an [IIS sub-application (sub-app)](/iis/get-started/planning-your-iis-architecture/understanding-sites-applications-and-virtual-directories-on-iis#applications). The sub-app's path becomes part of the root app's URL.
198
198
199
-
Static asset links within the sub-app should use tilde-slash (`~/`) notation in MVC and Razor Pages. Tilde-slash notation triggers a [Tag Helper](xref:mvc/views/tag-helpers/intro) to prepend the sub-app's pathbase to the rendered relative link. For a sub-app at `/subapp_path`, an image linked with `src="~/image.png"` is rendered as `src="/subapp_path/image.png"`. The root app's Static File Middleware doesn't process the static file request. The request is processed by the sub-app's Static File Middleware.
199
+
Static asset links within the sub-app should use tilde-slash (`~/`) notation in MVC and Razor Pages. Tilde-slash notation triggers a [Tag Helper](xref:mvc/views/tag-helpers/intro) to prepend the sub-app's pathbase to the rendered relative link. For a sub-app at `/subapp_path`, an image linked with `src="~/image.png"` is rendered as `src="/subapp_path/image.png"`. The root app's Static File Middleware doesn't process the static file request. The sub-app's Static File Middleware processes the request.
200
200
201
201
> [!NOTE]
202
202
> Razor components (`.razor`) shouldn't use tilde-slash notation. For more information, see <xref:blazor/host-and-deploy/app-base-path>.
@@ -219,10 +219,10 @@ For more information on the in-process hosting model and configuring the ASP.NET
219
219
220
220
## Application Pools
221
221
222
-
App pool isolation is determined by the hosting model:
222
+
The hosting model determines app pool isolation:
223
223
224
-
* In-process hosting: Apps are required to run in separate app pools.
225
-
* Out-of-process hosting: We recommend isolating the apps from each other by running each app in its own app pool.
224
+
***In-process hosting**: Apps are required to run in separate app pools.
225
+
***Out-of-process hosting**: We recommend isolating the apps from each other by running each app in its own app pool.
226
226
227
227
The IIS **Add Website** dialog defaults to a single app pool per app. When a **Site name** is provided, the text is automatically transferred to the **Application pool** textbox. A new app pool is created using the site name when the site is added.
228
228
@@ -240,7 +240,7 @@ If the IIS worker process requires elevated access to the app, modify the Access
240
240
241
241
1. Right-click on the directory and select **Properties**.
242
242
243
-
1. Under the **Security** tab, select the **Edit** button and then the **Add** button.
243
+
1. Under the **Security** tab, select the **Edit** button, and then the **Add** button.
244
244
245
245
1. Select the **Locations** button and make sure the system is selected.
246
246
@@ -260,19 +260,19 @@ Access can also be granted at a command prompt using the **ICACLS** tool. Using
For more information, see the [icacls](/windows-server/administration/windows-commands/icacls)topic.
263
+
For more information, see the [icacls](/windows-server/administration/windows-commands/icacls)article.
264
264
265
265
## HTTP/2 support
266
266
267
267
[HTTP/2](https://httpwg.org/specs/rfc7540.html) is supported with ASP.NET Core in the following IIS deployment scenarios:
268
268
269
269
* In-process
270
-
* Windows Server 2016/Windows 10 or later; IIS 10 or later
271
-
* TLS 1.2 or later connection
270
+
* Windows Server 2016/Windows 10 or later; IIS 10 or later.
271
+
* TLS 1.2 or later connection.
272
272
* Out-of-process
273
-
* Windows Server 2016/Windows 10 or later; IIS 10 or later
273
+
* Windows Server 2016/Windows 10 or later; IIS 10 or later.
274
274
* Public-facing edge server connections use HTTP/2, but the reverse proxy connection to the [Kestrel server](xref:fundamentals/servers/kestrel) uses HTTP/1.1.
275
-
* TLS 1.2 or later connection
275
+
* TLS 1.2 or later connection.
276
276
277
277
For an in-process deployment when an HTTP/2 connection is established, [`HttpRequest.Protocol`](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/2`. For an out-of-process deployment when an HTTP/2 connection is established, [`HttpRequest.Protocol`](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/1.1`.
278
278
@@ -290,8 +290,8 @@ For an ASP.NET Core app that targets the .NET Framework, OPTIONS requests aren't
290
290
291
291
When hosted in IIS by the ASP.NET Core Module version 2:
292
292
293
-
*[Application Initialization Module](#application-initialization-module): App's hosted [in-process](xref:host-and-deploy/iis/in-process-hosting) or [out-of-process](xref:host-and-deploy/iis/out-of-process-hosting) can be configured to start automatically on a worker process restart or server restart.
294
-
*[Idle Timeout](#idle-timeout): App's hosted [in-process](xref:host-and-deploy/iis/in-process-hosting) can be configured not to time out during periods of inactivity.
293
+
*[**Application Initialization Module**](#application-initialization-module): App's hosted [in-process](xref:host-and-deploy/iis/in-process-hosting) or [out-of-process](xref:host-and-deploy/iis/out-of-process-hosting) can be configured to start automatically on a worker process restart or server restart.
294
+
*[**Idle Timeout**](#idle-timeout): App's hosted [in-process](xref:host-and-deploy/iis/in-process-hosting) can be configured not to time out during periods of inactivity.
295
295
296
296
### Application Initialization Module
297
297
@@ -356,8 +356,8 @@ To prevent apps hosted [out-of-process](xref:host-and-deploy/iis/out-of-process-
356
356
### Application Initialization Module and Idle Timeout additional resources
@@ -430,17 +430,17 @@ When deploying apps to servers with [Web Deploy](/iis/install/installing-publish
430
430
431
431
1. Under the server's node, select **Application Pools**.
432
432
433
-
1. Right-click the site's app pool and select **Basic Settings** from the contextual menu.
433
+
1. Right-click the site's app pool, and select **Basic Settings** from the contextual menu.
434
434
435
435
1. In the **Edit Application Pool** window, set the **.NET CLR version** to **No Managed Code**:
436
436
437
437

438
438
439
439
ASP.NET Core runs in a separate process and manages the runtime. ASP.NET Core doesn't rely on loading the desktop CLR (.NET CLR). The Core Common Language Runtime (CoreCLR) for .NET is booted to host the app in the worker process. Setting the **.NET CLR version** to **No Managed Code** is optional but recommended.
440
440
441
-
* For a 32-bit (x86) [self-contained deployment](/dotnet/core/deploying/#self-contained-deployments-scd) published with a 32-bit SDK that uses the in-process hosting model, enable the Application Pool for 32-bit. In IIS Manager, navigate to **Application Pools** in the **Connections** sidebar. Select the app's Application Pool. In the **Actions** sidebar, select **Advanced Settings**. Set **Enable 32-Bit Applications** to `True`.
441
+
* For a 32-bit (x86) [self-contained deployment](/dotnet/core/deploying/#self-contained-deployments-scd) published with a 32-bit SDK that uses the in-process hosting model, enable the Application Pool for 32-bit. In IIS Manager, navigate to **Application Pools** in the **Connections** sidebar. Select the app's Application Pool. In the **Actions** sidebar, select **Advanced Settings**. Set **Enable 32-Bit Applications** to `True`.
442
442
443
-
* For a 64-bit (x64) [self-contained deployment](/dotnet/core/deploying/#self-contained-deployments-scd) that uses the in-process hosting model, disable the app pool for 32-bit (x86) processes. In IIS Manager, navigate to **Application Pools** in the **Connections** sidebar. Select the app's Application Pool. In the **Actions** sidebar, select **Advanced Settings**. Set **Enable 32-Bit Applications** to `False`.
443
+
* For a 64-bit (x64) [self-contained deployment](/dotnet/core/deploying/#self-contained-deployments-scd) that uses the in-process hosting model, disable the app pool for 32-bit (x86) processes. In IIS Manager, navigate to **Application Pools** in the **Connections** sidebar. Select the app's Application Pool. In the **Actions** sidebar, select **Advanced Settings**. Set **Enable 32-Bit Applications** to `False`.
444
444
445
445
1. Confirm the process model identity has the proper permissions.
446
446
@@ -457,9 +457,9 @@ Shadow copying app assemblies to the [ASP.NET Core Module (ANCM)](xref:host-and-
457
457
458
458
When an ASP.NET Core app is running on Windows, the binaries are locked so that they can't be modified or replaced. Shadow copying enables the app assemblies to be updated while the app is running by making a copy of the assemblies.
459
459
460
-
Shadow copy isn't intended to enable zero-downtime deployment, so its expected that IIS will still recycle the app, and some requests may get an[503 Service Unavailable](https://developer.mozilla.org/docs/Web/HTTP/Status/503) response. We recommend using a pattern like [blue-green deployments](https://www.martinfowler.com/bliki/BlueGreenDeployment.html) or [Azure deployment slots](/azure/app-service/deploy-best-practices#use-deployment-slots) for zero-downtime deployments. Shadow copy helps minimize downtime on deployments, but can't completely eliminate it.
460
+
Shadow copy isn't intended to enable zero-downtime deployment, so it's expected that IIS will still recycle the app, and some requests might get a[503 Service Unavailable](https://developer.mozilla.org/docs/Web/HTTP/Reference/Status/503) response. We recommend using a pattern like [blue-green deployments](https://www.martinfowler.com/bliki/BlueGreenDeployment.html) or [Azure deployment slots](/azure/app-service/deploy-best-practices#use-deployment-slots) for zero-downtime deployments. Shadow copy helps minimize downtime on deployments, but it can't completely eliminate it.
461
461
462
-
Shadow copying is enabled by customizing the ANCM handler settings in `web.config`:
462
+
Customizing the ANCM handler settings in `web.config` enables shadow copying:
0 commit comments