【发布时间】:2015-08-26 05:19:24
【问题描述】:
在发布到 Azure Web 应用程序时,最好在哪里为 ASP.NET 5 Web 应用程序的每个部署设置环境名称?
我了解需要设置ASPNET_DEV 环境变量。这在发布时可能吗?
这是我们的 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 "Restarting web app..."
Restart-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
或者我们是否在 Azure 门户中设置了环境变量?这会在部署之间持续存在吗?
如果这很重要,我正在使用带有 dnx451 目标框架的 ASP.NET 5 beta6 库。
【问题讨论】:
-
您在每个服务器/天蓝色应用程序中设置一次环境变量。您无需在每次发布时部署该变量。
标签: azure azure-web-app-service asp.net-core asp.net-core-mvc dnx