I've recently started working with Microsoft Web Deploy.
I got backups working in a basic configuration and now I'd like to experiment with adding some folder exclusions to the .pubxml
file in my projects based on the comments to this answer.
Here are my deploy settings:
cd "\Program Files\IIS\Microsoft Web Deploy V3\scripts\"
. .\BackupScripts.ps1
Reset-BackupSettings
TurnOn-Backups -On $true
Configure-Backups -Enabled $true
Configure-Backups -ContinueSyncOnBackupFailure $false
Configure-Backups -NumberOfBackups 5
Configure-Backups -BackupPath "D:\UAT\AppBackups\{siteName}_snapshots"
Configure-BackupSettingsProvider -CanAddExcludedProviders $true
Get-BackupSettings
This works until I paste this snippet into my publish profile:
<Target Name="AddCustomSkipRules">
<ItemGroup>
<MsDeploySkipRules Include="SkipAppDataFolder">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\App_Data$</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
A publish attempt with that code fails, and then seems to get stuck. Removing the snippet and republishing still fails.
Here's the error I get from the trace:
>trace eventLevel="Error" message="BACKUP_FAILED - Skipping backup because it failed due to an unknown reason.%C2%A0For more information, contact your server administrator."
AspNetModuleDiagErrorEvent
Uri /msdeploy.axd
User: username
Client IP: 10.148.69.225
Content-Type: application/msdeploy
Version: 9.0.0.0
MSDeploy.VersionMin: 7.1.600.0
MSDeploy.VersionMax: 9.0.3802.0
MSDeploy.Method: Sync
MSDeploy.RequestId: fa27c81c-12aa-47f3-ac37-7ea94caa14a4
MSDeploy.RequestCulture: en-US
MSDeploy.RequestUICulture: en-US
ServerVersion: 9.0.1973.0
Skip: objectName="^configProtectedData$"
Provider: auto, Path: A tracing deployment agent exception occurred that was propagated to the client.
Request ID 'fa27c81c-12aa-47f3-ac37-7ea94caa14a4'.
Request Timestamp: '11/10/2021 5:08:45 PM'.
Error Details:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at Microsoft.Web.Deployment.BackupManager.HandleExceptionForBackupFailure(DeploymentBaseContext baseContext, BackupSettings settings, Exception ex, Boolean suppressLogging)
at Microsoft.Web.Deployment.BackupRuleHandler.PreSync(DeploymentSyncContext syncContext)
at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable``1 syncPassId, String syncSessionId)
at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId, String user, String siteName)
at Microsoft.Web.Deployment.DeploymentAgent.HandleRequestWorker(DeploymentAgentAsyncData asyncData)
at Microsoft.Web.Deployment.DeploymentAgent.HandleRequest(DeploymentAgentAsyncData asyncData)
Restarting IIS or the Web Deploy service doesn't help and I'd rather not restart the entire server if I can help it.
How can I get the backup service unstuck?