首页 文章

Visual Studio Team Services Azure部署任务无法部署Web应用程序

提问于
浏览
0

我们最近 Build 了一个新的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

这是一个相当重要的问题,因为它阻止我们此时使用持续部署 . 是否有任何解决方法或配置设置我们应该注意解决这个问题?

3 回答

  • 1

    如果Web App启用了VS 2015调试,则会导致从VSTS发布失败的已知问题 . 您能否检查一下是否属于这种情况,并在关闭Azure门户中的调试后再试一次?

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

  • 2

    这最终可以追溯到两个问题 .

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

    第二个问题似乎与David Ebbo在answer中提到的known bug有关 .

  • 0

    您可以尝试几件事:

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

    Get-AzureSubscription - 当前

    在脚本顶部的命令,看看这是否是你所期望的 .

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

    enter image description here

相关问题