azure-pipelines-tasks: "Remove additional files at destination" tries to remove App_Data\jobs but fails

Hi guys,

We noticed that after enabling “Remove additional files at destination” that some of our releases failed with the following message (as a pre-caution we do take the app service offline to ensure files are not in use however web jobs, particularly Application Insights Profile, may fall outside of this scope).

2017-06-08T22:31:02.0197305Z ##[section]Starting: Deploy the Website
2017-06-08T22:31:02.0207304Z ==============================================================================
2017-06-08T22:31:02.0207304Z Task         : Azure App Service Deploy
2017-06-08T22:31:02.0207304Z Description  : Update Azure App Service using Web Deploy / Kudu REST APIs
2017-06-08T22:31:02.0207304Z Version      : 3.3.6
2017-06-08T22:31:02.0207304Z Author       : Microsoft Corporation
2017-06-08T22:31:02.0207304Z Help         : [More Information](https://aka.ms/azurermwebdeployreadme)
2017-06-08T22:31:02.0207304Z ==============================================================================
2017-06-08T22:31:02.5947349Z fa2c3c8c-144d-4a56-ba15-1c9de91ed6e3 exists true
2017-06-08T22:31:05.8314062Z Got connection details for Azure App Service:'gcvp-dev-aus'
2017-06-08T22:31:18.6024049Z ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.
2017-06-08T22:31:19.7484060Z [command]d:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.6\ctt\ctt.exe s:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\Web.config t:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\Web.Development.config d:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\Web.config pw
2017-06-08T22:31:19.9824062Z [command]d:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.6\ctt\ctt.exe s:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\bin\Web.config t:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\bin\Web.Development.config d:d:\a\r1\a\temp_web_package_6916328397802707\Content\d_C\a\1\s\Gtwm.UI\GetTheWorldMoving\obj\Debug\Package\PackageTmp\bin\Web.config pw
2017-06-08T22:31:20.1924058Z XML Transformations applied successfully
2017-06-08T22:31:45.1784063Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='d:\a\r1\a\temp_web_package_3243713071943448.zip' -dest:auto,ComputerName='https://gcvp-dev-aus.scm.azurewebsites.net:443/msdeploy.axd?site=gcvp-dev-aus',UserName='********',Password='********',AuthType='Basic' -setParam:name='IIS Web Application Name',value='gcvp-dev-aus' -userAgent:VSTS_ec22fe19-8121-4cb0-b90f-54a3dcbb6beb_release_7_177_351_1
2017-06-08T22:31:45.9494061Z Info: Using ID '58006f4b-864a-44c0-8ec4-df22b0329e87' for connections to the remote server.
2017-06-08T22:31:52.2212691Z Info: Deleting file (gcvp-dev-aus\App_Data\jobs\continuous\ApplicationInsightsProfiler\ApplicationInsightsProfiler.exe).
2017-06-08T22:31:52.2222688Z Info: Deleting file (gcvp-dev-aus\App_Data\jobs\continuous\ApplicationInsightsProfiler\ApplicationInsightsProfiler.exe.config).
2017-06-08T22:31:52.2222688Z Info: Deleting directory (gcvp-dev-aus\App_Data\jobs\continuous\ApplicationInsightsProfiler).
2017-06-08T22:31:52.2222688Z Info: Deleting directory (gcvp-dev-aus\App_Data\jobs\continuous).
2017-06-08T22:31:52.2222688Z Info: Deleting directory (gcvp-dev-aus\App_Data\jobs).
2017-06-08T22:31:52.4342685Z ##[error]Failed to deploy web package to App Service.
2017-06-08T22:31:52.4352691Z ##[error]Error: (6/8/2017 10:31:52 PM) An error occurred when the request was processed on the remote computer.
Error: An error was encountered when processing operation 'Delete Directory' on 'D:\home\site\wwwroot\App_Data\jobs'.
Error: The error code was 0x80070091.
Error: The directory is not empty.

   at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
   at Microsoft.Web.Deployment.DirectoryEx.Delete(String path)
   at Microsoft.Web.Deployment.DirPathProviderBase.Delete(Boolean whatIf)
Error count: 1.

2017-06-08T22:31:52.4352691Z ##[error]Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
2017-06-08T22:31:52.9850754Z Successfully updated deployment History at https://gcvp-dev-aus.scm.azurewebsites.net/deployments/1771496961112422
2017-06-08T22:31:53.0370736Z ##[section]Finishing: Deploy the Website

By either manually removing the App_Data\jobs folder in the SCM site or disabling “Remove additional files at destination” we were able to successfully release. But ideally, we’d like to be able to both remove files we deleted in a prior commit and keep our web jobs running.

Is there something I am missing or is this a conflict between the way App Insights deploys the profiling tool and the way the Azure App Service Deploy tasks deletes files?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 22 (8 by maintainers)

Most upvoted comments

I have the same issue, but using the suggested approach 1 is not possible as I deploy through AMR templates (MS Deploy task)

Will the ARM MS Deploy task be updated with this approach?

@jamesaarondevlin , can you please try the approach 1 and check if the issue still happening?