VSTS - 在部署前使应用程序脱机 [英] VSTS - Take app offline before deployment

查看:21
本文介绍了VSTS - 在部署前使应用程序脱机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 VSTS 持续部署到 azure 时遇到了这个问题

I'm getting this problem using VSTS continuous deployment to azure

Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process

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

the solution provided in this thread is to manually restart my app in azure, however he's not using VSTS and the question was asked 2 years ago, is this issue fixed on the current VSTS and if so, I would like to know how because I'm having the same problem as the link referenced above.

谢谢

推荐答案

您可以按照此处的说明使用EnableMSDeployAppOffline"功能在部署前将您的应用设置为离线:应用离线和使用校验和的网络发布更新.

You can use "EnableMSDeployAppOffline" feature to set your app offline before deployment by following the instruction here: Web publishing updates for app offline and usechecksum.

如果还是不行,您还可以创建如下的PowerShell脚本来停止应用程序,部署然后重新启动应用程序:

If it does not work, you can also create a PowerShell script as following to stop the app, deploy and then restart the app:

    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.0Common7IDEExtensionsMicrosoftWeb ToolsPublishScriptsdefault-publish.ps1"

. $publishScript -publishProperties $publishProperties  -packOutput $packOutput

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

PowerShell 脚本来自:构建和部署ASP.NET 5 应用程序到 Azure Web 应用程序.

PowerShell Script from: Build and Deploy your ASP.NET 5 Application to an Azure Web App.

这篇关于VSTS - 在部署前使应用程序脱机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆