azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

webapp:Support AppOffline With Publish-AzureWebsiteProject

Open martincostello opened this issue 11 years ago • 33 comments

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.

martincostello avatar Jul 30 '15 09:07 martincostello

Absolutely! Getting the same problem here, our build keeps randomly failing.

pbevis avatar Aug 19 '15 07:08 pbevis

+1 - please add support for AppOffline!

jkonecki avatar Sep 29 '15 12:09 jkonecki

+1

GraemeSMiller avatar Oct 01 '15 17:10 GraemeSMiller

+1

gligoran avatar Oct 20 '15 13:10 gligoran

+1

jakubka avatar Oct 21 '15 11:10 jakubka

+1 - major pain for our team

danbucholtz avatar Oct 22 '15 17:10 danbucholtz

+1

ajross avatar Oct 23 '15 09:10 ajross

+1

rhythmnewt avatar Oct 31 '15 18:10 rhythmnewt

+1

martyMM avatar Nov 04 '15 22:11 martyMM

I think that makes +10 now. Is this planned any time soon?

martincostello avatar Nov 04 '15 22:11 martincostello

+1

vipervf1 avatar Nov 04 '15 22:11 vipervf1

+1

SomaticIT avatar Dec 12 '15 13:12 SomaticIT

+1 .. please!

tgfl-tom avatar Jan 26 '16 21:01 tgfl-tom

+1

abatishchev avatar Feb 16 '16 20:02 abatishchev

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?

seanfisher avatar Feb 17 '16 17:02 seanfisher

+1

brentlyjdavid avatar Mar 18 '16 12:03 brentlyjdavid

Will Additional Arguments: -enableRule:AppOffline work for this?

abatishchev avatar Apr 14 '16 00:04 abatishchev

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.

brentlyjdavid avatar Apr 14 '16 12:04 brentlyjdavid

+1

Rogn avatar Apr 26 '16 06:04 Rogn

+1

AndreaPic avatar May 09 '16 10:05 AndreaPic