Skip to content

Shadow copying for ASP.NET Core 8 seems to be broken #52525

@TimKras

Description

@TimKras

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

It seems that the Shadow Copy feature in IIS is broken since the .Net Core 8 upgrade.
This is the Web.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
      <handlerSettings>
        <handlerSetting name="enableShadowCopy" value="true" />
        <handlerSetting name="shadowCopyDirectory" value="../_shadowcopy" />
      </handlerSettings>
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Test" />
      </environmentVariables>
    </aspNetCore>
  </system.webServer>
</configuration>

Everything is working fine the first time: a shadow folder is created and the site is responding.
When redeploying (copy) the site, the site is not responding, it keeps loading.
A new shadow folder is created, but the site stays unreponsive.

Some logs:

[2023-12-01T22:03:48.421Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:03:48.537Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:03:48.618Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:03:48.627Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.044Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.068Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.153Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.155Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.536Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.551Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.615Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.617Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.825Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.838Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:04:01.905Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:04:01.907Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:05:01.003Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:05:01.019Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:05:01.128Z, PID: 3460] [aspnetcorev2_inprocess.dll] Adding request. Total Request Count 1
[2023-12-01T22:05:01.130Z, PID: 3460] [aspnetcorev2_inprocess.dll] Removing Request 0
[2023-12-01T22:05:02.404Z, PID: 3460] [aspnetcorev2_inprocess.dll] Detected dll change, resetting timer callback which will eventually trigger shutdown.
[2023-12-01T22:05:02.406Z, PID: 3460] [aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange 'MACHINE/WEBROOT/APPHOST/REPORTAPI'
[2023-12-01T22:05:02.407Z, PID: 3460] [aspnetcorev2.dll] Stopping application '/LM/W3SVC/4/ROOT'
[2023-12-01T22:05:02.409Z, PID: 3460] [aspnetcorev2_inprocess.dll] Stopping file watching.
[2023-12-01T22:05:02.409Z, PID: 3460] [aspnetcorev2_inprocess.dll] Waiting for file watcher thread to exit.
[2023-12-01T22:05:07.406Z, PID: 3460] [aspnetcorev2_inprocess.dll] Starting copy on shutdown in file watcher, creating directory.
[2023-12-01T22:05:07.408Z, PID: 3460] [aspnetcorev2_inprocess.dll] Copying new shadow copy directory to C:\_shadowcopy\65.
[2023-12-01T22:05:07.905Z, PID: 3460] [aspnetcorev2_inprocess.dll] Finished copy on shutdown to C:\_shadowcopy\65. 150 files copied.
[2023-12-01T22:05:07.908Z, PID: 3460] [aspnetcorev2_inprocess.dll] Received file change notification in application 'C:\ReportApi\'
[2023-12-01T22:05:07.909Z, PID: 3460] [aspnetcorev2_inprocess.dll] Event Log: 'Application 'C:\ReportApi\' was recycled after detecting file change in application directory.' 
End Event Log Message.

A workaround is restarting the Application pool (but this operation takes several minutes).

image

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

8.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-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