webapp:Support AppOffline With Publish-AzureWebsiteProject
Occasionally when publishing to an Azure Web App from Visual Studio Online an error similar to the following occurs:
Web Deploy cannot modify the file '{FILENAME}' 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.
The Publish-AzureWebsiteProject cmdlet should support a parameter with allows the AppOffline rule to be used, or indeed a way to pass arbitrary additional flags on to MSDeploy.
Absolutely! Getting the same problem here, our build keeps randomly failing.
+1 - please add support for AppOffline!
+1
+1
+1
+1 - major pain for our team
+1
+1
+1
I think that makes +10 now. Is this planned any time soon?
+1
+1
+1 .. please!
+1
This is a major deal for us because we need automated continuous integration, not something where a person has to go click the websites off and on again. From Microsoft/vso-agent-tasks#1233 :
I've run into this as well. Here's what we're doing as a work around. We run an Azure Resource Manager powershell script with something like the following code as Manage-WebApps.ps1:
Param(
[Parameter(Mandatory = $true, ParameterSetName = 'Start')]
[Parameter(Mandatory = $true, ParameterSetName = 'Stop')]
[string]$Environment,
[Parameter(Mandatory = $true, ParameterSetName = 'Start')]
[switch]$Start,
[Parameter(Mandatory = $true, ParameterSetName = 'Stop')]
[switch]$Stop
)
$ResourceGroup = "--Your Resource Group--"
$appsToManage = @("app1", "app2", "appN")
ForEach ($app in $appsToManage) {
$appName = "$Environment-$app"
if ($Start) {
Start-AzureRmWebApp -ResourceGroupName $ResourceGroup -Name $appName | Out-Null
Write-Host "Started web app '$appName'"
}
if ($Stop) {
Stop-AzureRmWebApp -ResourceGroupName $ResourceGroup -Name $appName | Out-Null
Write-Host "Stopped web app '$appName'"
}
}
We'll run this at the beginning of the release:
Manage-WebApps.ps1 -Stop -Environment dev
And this at the end:
Manage-WebApps.ps1 -Start -Environment dev
What other work-arounds have people found?
+1
Will Additional Arguments: -enableRule:AppOffline work for this?
I think so, as long as that's also available as some type of drop down in the build step, so the argument is added to the vNext builds automatically based on that.
+1
+1