Azure-pipelines-tasks: AzureRmWebAppDeployment fails to stop WebApp and fails with ERROR_FILE_IN_USE

Created on 22 Dec 2016  Â·  12Comments  Â·  Source: microsoft/azure-pipelines-tasks

Our Release script uses the "Deploy AzureRM Web App" task and we have set "Take App Offline" to true.

Our WebApp no longer deploys, we get the following errors in the log:

2016-12-22T09:15:40.4470806Z ##[error]Failed to deploy website.

2016-12-22T09:15:40.4470806Z ##[error]Error Code: ERROR_FILE_IN_USE

2016-12-22T09:15:40.4470806Z More Information: Web Deploy cannot modify the file 'OurWebApp.exe' on the destination because it is locked by an external process.  In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.

2016-12-22T09:15:40.4470806Z Error count: 1.

This used to work a while back, I am not quite sure when this error started happening.
If we manually stop the app, the deploy works.

Release

Most helpful comment

FILE_IN_USE error occurs when DLL's are locked. App_offline brings the app down and unlocks the resource. ASPCore Module requires app_offline.htm but MSDeploy provides App_Offline.htm (case sensitive).

The fix for app_offline issue will be available soon.

All 12 comments

I have the same issue. Happening with all our ASP.NET Web Apps at the moment.

I'm also having this issue. Has it stopped it in the past and/or should it? I would think so.

Right, so, turns out that the app_offline.htm for ASP.NET Core based apps might not work the same way as old school IIS Handler. This is in the case of using ASP.NET Core, as it deploys an executable.

If your apps are set the Always On, try turning that particular setting off and deploying then turning it on again. I've just talked to someone at MSFT and they've said that Always On can intermittently cause issues and lock DLLs.

My issue is the "Take App Offline" tick box no longer has any bearing on the process:

image

It says it uses app_offline.htm but I don't think it's working correctly behind the scenes.

Thanks. My app is also ASP.NET Core. So I'd have to do what Frank recommends here? Seems like the task should be able to do this.

https://blogs.msdn.microsoft.com/azuredev/2016/05/22/visual-studio-team-services-azure-web-app-deployment-failure-error_file_in_use/comment-page-1/

I used Azure PowerShell (as that article mentioned) and stopped the slots manually. Still a bit strange that this has randomly popped up as an issue, we've had these pipelines running for months now with no issue.

I am also seeing an increase in this issue recently. I've even disabled Always On where it was being used and the issue still persists. This makes our automated deployment process very difficult.

If you're looking to ensure this doesn't happen in your release pipelines
you will need to stop the instance (we stop a slot and then swap for zero
down time) with azure power shell.

We have created some scripts and task groups for reuse purposes, it makes
it easier if you have lots of Web Apps in one project.

It might be worth someone creating a task and putting on the market place?

On Thu, 29 Dec 2016 at 22:04, mclark1129 notifications@github.com wrote:

I am also seeing an increase in this issue recently. I've even disabled
Always On where it was being used and the issue still persists. This makes
our automated deployment process very difficult.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vsts-tasks/issues/3293#issuecomment-269700671,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWhfP0IzfLr4XuTGcxg3uVf4qIFUoryks5rNC5cgaJpZM4LTyiF
.

@iamthemovie I realize that there is a workaround we can use, but it does seem like this is the responsibility of this task. Also like you mentioned this has not been a problem for months, and has only started happening recently, which seems like something new might have been introduced which caused a regression.

Occasionally I will also see Error Code: ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER which I believe means the same thing.

@treierts, @mclark1129 , @iamthemovie , Currently we are investigating this issue.
Can u restart the app as a workaround or set MSDEPLOY_RENAME_LOCKED_FILES to 1 in Application settings (Azure Portal).

image

FILE_IN_USE error occurs when DLL's are locked. App_offline brings the app down and unlocks the resource. ASPCore Module requires app_offline.htm but MSDeploy provides App_Offline.htm (case sensitive).

The fix for app_offline issue will be available soon.

Closing it as there is another issue tracking the same https://github.com/Microsoft/vsts-tasks/issues/3312

Was this page helpful?
0 / 5 - 0 ratings