dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.74k stars 1.07k forks source link

[WebDeploy] WDP fails to sync when package comes from a DevDrive #40562

Open jirikanda opened 6 months ago

jirikanda commented 6 months ago

Describe the bug

We receive this error when publishing WDP using webdeploy.exe when the WDP comes from a DevDrive.

The synchronization is being stopped because the maximum number of sync passes '5' has been exceeded even though all the changes could not be applied. This could occur if there are external changes being made to the destination.

To Reproduce

We did not reproduce the issue with the ASP.NET WebForms projects. They are deployed with no problems. We did reproduce the issue with most of out ASP.NET Core projects. But not with all of them.

More information

When the WDP is created on a non-DevDrive (NTFS), the msdeploy.exe log contains:

Verbose: Source filePath (...app_data\jobs\continuous\JobsRunner\FluentValidation.dll) does not match destination (...\app_data\jobs\continuous\JobsRunner\FluentValidation.dll) differing in attributes (checksum['0','474458346']). Update pending. ... Verbose: The synchronization completed in 2 pass(es).

When the WDP is created on a DevDrive (ReFS), the msdepoy.exe log contains:

Verbose: Source filePath (...app_data\jobs\continuous\JobsRunner\FluentValidation.dll) does not match destination (...\app_data\jobs\continuous\JobsRunner\FluentValidation.dll) differing in attributes (attributes['Archive, SparseFile','Archive']). Update pending. ... Verbose: Received response from agent (HTTP status 'OK'). Verbose: The current synchronization pass is missing stream content for 1039 objects. ... Error: The synchronization is being stopped because the maximum number of sync passes '5' has been exceeded even though all the changes could not be applied. This could occur if there are external changes being made to the destination.

Our command line looks this way:

C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted -useChecksum -source:package="C:\Users\buildrunner\AppData\Local\Temp\qzuin2ae.4ci.zip" -dest:auto,computerName="stage.ourserver.local",includeAcls=False,authType=ntlm -setParam:name="IIS Web Application Name",value="ourwebapp" -skip:objectName=filePath,skipAction=Delete,absolutePath=\app_offline.htm$

Next observation

Then the files in the target are removed before deployment starts, one deployment passes. Next deployment fails again with the same error.

Workaround

Unknown. Do not use DevDrive on build machine(s).

Further technical details

KalleOlaviNiemitalo commented 6 months ago

If FILE_ATTRIBUTE_SPARSE_FILE cannot be set via SetFileAttributesW and instead requires FSCTL_SET_SPARSE and is not supported on all file systems, MSDeploy.exe should preferably ignore differences on that attribute.

But also the web SDK could be changed not to store that attribute in the zip package. Is the zip package now constructed by a task called by MSBuild, or does the SDK start a MSDeploy process for that purpose? IIRC there is some property that lets the project choose, but what is the default value…?

jirikanda commented 3 months ago

Hi @KalleOlaviNiemitalo,

thanks for your initial reply.

Is there a plan to fix the issue and allow the WDP created on a DevDrive to be deployed to IIS or Azure App Services using WebDeploy?

KalleOlaviNiemitalo commented 3 months ago

@jirikanda, I neither work for Microsoft nor develop MSBuild or MSDeploy, so I don't know what they intend to do with this issue.

jirikanda commented 3 months ago

Oh, sorry, @KalleOlaviNiemitalo. My mistake... You were the only one who answered. I thought...