【问题标题】:Visual Studio Team Services Azure Deployment task fails to deploy web appVisual Studio Team Services Azure 部署任务无法部署 Web 应用
【发布时间】:2016-03-04 15:45:12
【问题描述】:

我们最近建立了一个新的 Azure 帐户,并且正在开发一个新的应用程序,以将其作为 Web 应用程序部署到该帐户。虽然我们能够从 Visual Studio 2015 部署到暂存槽,但在尝试从 Visual Studio Team Services(由 Microsoft 托管)部署自动构建时,我们收到以下错误:

Get-AzureWebSite -Name $APPLICATION -ErrorAction SilentlyContinue -ErrorVariable azureWebSiteError -Slot staging
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand.Do(Action call) in d:\workspace\powershell-publish\src\ServiceManagement\Services\Commands\Websites\GetAzureWebSite.cs:line 138
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzureSMCmdlet.ProcessRecord() in d:\workspace\powershell-publish\src\ServiceManagement\Common\Commands.ServiceManagement.Common\AzureSMCmdlet.cs:line 174
New-AzureWebSite -Name $APPLICATION -Location North Central US -Slot staging
Conflict: Website with given name $APPLICATION already exists.
Publish-AzureWebsiteProject -Name "$APPLICATION" -Package "C:\a\1\a\$APPLICATION.zip" -Slot "staging"  -ErrorVariable publishAzureWebsiteError
The website $APPLICATION was not found. Please specify a valid website name.
Cannot get website, deployment status is not updated

这是一个相当重要的问题,因为它阻止了我们此时使用持续部署。是否有任何解决方法或配置设置可供我们查看以解决此问题?

【问题讨论】:

  • 一条可能相关也可能不相关的信息是,由于我在多个项目中的角色,我有两个与我的帐户相关联的订阅。据我所知,如果配置正确,这不会影响部署。

标签: visual-studio azure-web-app-service azure-deployment


【解决方案1】:

如果 Web 应用启用了 VS 2015 调试,有一个已知问题会导致从 VSTS 发布失败。您能否检查一下是否适合您,并在 Azure 门户中关闭调试后重试?

该问题将很快得到解决,因此请将此视为临时解决方法。

【讨论】:

  • 这是我们实际尝试的第一件事。现在,Web 应用程序和部署槽都设置为 VS 2013 并关闭调试。
  • 是的,这是一个很长的镜头。你一定是遇到了一个单独的条件。
  • 我已关闭远程调试,这是默认设置。我有一个 BASIC App Service 实例,所以没有插槽。但我无法解决这个问题。有没有办法定义 VSTO 使用的 powershell 脚本?我现在已经尝试了几个项目。新网站,新项目。即使是一个文件新项目,也只有最低限度的 API 控制器设置。在这一步一切都失败了。
  • 查看下面的链接。对我有用的完整过程是将调试版本设置为较早的 vs 版本,然后关闭远程调试:stackoverflow.com/a/35852636/92364
【解决方案2】:

这最终追溯到两个问题。

第一个问题是我们需要加载不同的管理证书,因为我们使用的管理证书默认使用不同的帐户。这又回到了一个帐户与多个订阅相关联的问题。在撰写本文时,似乎还没有指定 which subscription to download 的方法。

第二个问题似乎与 David Ebbo 在其answer 中提到的known bug 相关。

【讨论】:

    【解决方案3】:

    您可以尝试几件事:

    • 由于您提到您有 2 个订阅,请确保您上面的脚本针对正确的订阅运行,如果不是,它会给出您所看到的确切错误。放一个:

      Get-AzureSubscription -Current

    脚本顶部的命令,看看是否符合您的预期。

    • VSTS 有一个用于部署到 Web 应用程序的构建任务,您可以使用该任务部署包吗?

    【讨论】:

    • 由于这是托管的 VSTS,我无法控制部署向导运行的 Powershell 脚本 - 这些脚本与 Azure Web 应用程序部署过程中提供的脚本相同。不过,正如我之前提到的,Visual Studio 2015 的部署很好,通常我的期望是 VSTS 应该与 VS2015 大致相同。
    • 你能澄清一下 - 你是如何从你的 OP 获得输出的?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-12
    • 2013-12-23
    • 2017-02-16
    • 2017-12-14
    • 1970-01-01
    相关资源
    最近更新 更多