Skip to content

ANCM is not stable after upgrading to .net 9 #59107

@ailenhe888

Description

@ailenhe888

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Since upgrading to .net 9, all existing core app start to get "HTTP Error 503.0 - Service Unavailable" in shared application pool frequently, no matter inprocess or outofprocess mode. Looks like the core apps are impacted by each other.

Expected Behavior

The problem can be fixed if manually change ANCM in "C:\Program Files\IIS\Asp.Net Core Module\V2" from v19.0.24303 to v18.0.24081. So, something is changed in new ANCM and caused the issue.

Steps To Reproduce

  1. Install .NET Hosting Bundle

Install the dotnet-hosting-9.0.0-win.exe on a Windows Server 2022 machine.

  1. Create Sites in IIS
    Create two sites in IIS:
    site2 (a working Core application)
    site3 (which will contain a test configuration)
    Ensure both sites use the same application pool.

  2. Configure Site3

For site3, add a web.config file with the following test data:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <compilation tempDirectory="C:\Inetpub\test\tmp" />
  </system.web>
</configuration>
  1. Test Site2 and Site3
    Visit site2 first; it should work as expected (Core app is running).
    Visit site3 next, and you will see the expected error:
    "Parser Error Message: The 'tempDirectory' attribute must be set to a valid absolute path."

  2. Revisit Site2

After encountering the error on site3, visit site2 again. You should see the following error:

"HTTP Error 503.0 - Service Unavailable"

  1. Check Debug Logs

Inspect the debug logs for any relevant details. You may find that ANCM is continuously monitoring changes in the application pool. For example:

[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange 'MACHINE/WEBROOT/APPHOST/test-114-SITE3'

Exceptions (if any)

[2024-11-22T13:04:18.446Z, PID: 10040] [aspnetcorev2_outofprocess.dll] FORWARDING_HANDLER::OnAsyncCompletion Done 1
[2024-11-22T13:04:18.459Z, PID: 10040] [aspnetcorev2_outofprocess.dll] FORWARDING_HANDLER::OnAsyncCompletion Done 0
[2024-11-22T13:04:18.472Z, PID: 10040] [aspnetcorev2_outofprocess.dll] FORWARDING_HANDLER::~FORWARDING_HANDLER
[2024-11-22T13:04:28.243Z, PID: 10040] [aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange 'MACHINE/WEBROOT/APPHOST/test-114-SITE3'
[2024-11-22T13:04:28.244Z, PID: 10040] [aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalApplicationStop
[2024-11-22T13:04:28.256Z, PID: 10040] [aspnetcorev2.dll] Shutdown starting in 5000 ms.
[2024-11-22T13:04:33.263Z, PID: 10040] [aspnetcorev2.dll] Shutdown starting.
[2024-11-22T13:04:33.270Z, PID: 10040] [aspnetcorev2.dll] Stopping application '/LM/W3SVC/1120488701/ROOT'
[2024-11-22T13:04:33.276Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Stopping file watching.
[2024-11-22T13:04:33.282Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Waiting for file watcher thread to exit.
[2024-11-22T13:04:33.282Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Stopping file watcher thread
[2024-11-22T13:04:33.295Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Waiting for file watcher thread to exit.
[2024-11-22T13:04:33.305Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Event Log: 'Sent shutdown HTTP message to process with Id '10204' and received http status '202'.'
End Event Log Message.
[2024-11-22T13:04:33.332Z, PID: 10040] [aspnetcorev2_outofprocess.dll] Event Log: 'Application '/LM/W3SVC/1120488701/ROOT' with physical root 'h:\root\home\test-114\www\site2' shut down process with Id '10204' listening on port '30915''
End Event Log Message.
[2024-11-22T13:04:34.144Z, PID: 10040] [aspnetcorev2.dll] Received a request during shutdown. Will return a 503 response.
[2024-11-22T13:04:34.154Z, PID: 10040] [aspnetcorev2.dll] Failed HRESULT returned: 0x800704e7 at D:\a_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\proxymodule.cpp:97
[2024-11-22T13:04:34.161Z, PID: 10040] [aspnetcorev2.dll] Failed HRESULT returned: 0x800704e7 at D:\a_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\proxymodule.cpp:121
[2024-11-22T13:04:34.270Z, PID: 10040] [aspnetcorev2.dll] Received a request during shutdown. Will return a 503 response.
[2024-11-22T13:04:34.299Z, PID: 10040] [aspnetcorev2.dll] Failed HRESULT returned: 0x800704e7 at D:\a_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\proxymodule.cpp:97
[2024-11-22T13:04:34.323Z, PID: 10040] [aspnetcorev2.dll] Failed HRESULT returned: 0x800704e7 at D:\a_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\proxymodule.cpp:121

.NET Version

.net 9

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: DuplicateResolved as a duplicate of another issueStatus: Resolvedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-iisIncludes: IIS, ANCM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions