We have a Windows Server 2022 and Windows Server 2019 servers with Web Deploy 3.6 installed. Everything has been working perfectly and we had been able to deploy perfectly without issue. We have been able to deploy manually from Visual Studio (publishing a site). We can also deploy using Github actions such as this:
dotnet build WebsiteProjects\Website.Site\Website.Site.csproj /p:Configuration=Release /p:PublishProfile=WebsiteProjects\Website.Site\Properties\PublishProfiles\LIVE.pubxml /p:DeployOnBuild=True /p:Password="${{ secrets.PROD_PASS }}"
However over the last month, we just simply cannot deploy things any more.
When deploying from Visual Studio we get this error:
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): Error : Web deployment task failed. (The synchronization is being stopped because the maximum number of sync passes '10' 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.) Publish failed to deploy.
If we use GitHub actions, we get this error:
MSDEPLOY : error : The synchronization is being stopped because the maximum number of sync passes '10' 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. [C:\actions-runner_work\Site\Site\WebServiceProjects\WebService.SiteApi\WebService.SiteApi.csproj]
Absolutely nothing has changed on these servers for years, with exception of Windows Updates, and adding/removing sites. The publish profiles have not changed either.
Disabling Windows Defender does not help. Restarting the Web Deployment agent does not help. Restarting the server does not help. Restarting IIS or disabling the site while deploying does not help.
Sometimes if I stop the site and delete all the files in the inetpub folder the deploy will work - this seems to be the only way to get web deploy to work, but its not consistent.
Note we tried this with .NET 7 and .NET 8 SDKs - same issue. I logged this through Visual Studio as I initially thought it was an issue from one of their updates. I also don't see anything interesting in the event viewer.
Really am at a loss as we are now unable to run GitHub actions for deployments and cannot even deploy manually from Visual Studio to the servers. Any suggestions on how to fix or diagnose what is happening?
Example publish profile:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://...</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<TargetFramework>net7.0</TargetFramework>
<ProjectGuid>2ca81a89-d8b9-4f72-ba22-dd26757ef8d6</ProjectGuid>
<SelfContained>false</SelfContained>
<_IsPortable>true</_IsPortable>
<MSDeployServiceURL>...</MSDeployServiceURL>
<DeployIisAppPath>...</DeployIisAppPath>
<RemoteSitePhysicalPath />
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<UserName>Administrator</UserName>
<_SavePWD>true</_SavePWD>
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
<MSDeployUseChecksum>true</MSDeployUseChecksum>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
