VSTS - 在部署之前使应用程序脱机

时间:2016-05-15 02:43:25

标签: c# azure tfs azure-devops continuous-deployment

我使用VSTS连续部署到azure

时遇到了这个问题
Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process

this thread中提供的解决方案是在azure中手动重启我的应用程序,但是他没有使用VSTS并在2年前问过这个问题,这个问题是否已修复在当前的VSTS上,如果有的话,我想知道如何,因为我遇到与上面引用的链接相同的问题。

由于

1 个答案:

答案 0 :(得分:4)

您可以使用“EnableMSDeployAppOffline”功能在部署之前按照以下说明设置您的应用离线:Web publishing updates for app offline and usechecksum

如果它不起作用,您还可以创建PowerShell脚本,如下所示:停止应用,部署然后重新启动应用:

    param($websiteName, $packOutput)

    $website = Get-AzureWebsite -Name $websiteName

    # get the scm url to use with MSDeploy.  By default this will be the second in the array
    $msdeployurl = $website.EnabledHostNames[1]


    $publishProperties = @{'WebPublishMethod'='MSDeploy';
                            'MSDeployServiceUrl'=$msdeployurl;
                            'DeployIisAppPath'=$website.Name;
                            'Username'=$website.PublishingUsername;
                            'Password'=$website.PublishingPassword}

    Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName

Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"

. $publishScript -publishProperties $publishProperties  -packOutput $packOutput

Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName

来自Build and Deploy your ASP.NET 5 Application to an Azure Web App的PowerShell脚本。

相关问题