Azure Web App中的ASP.NET 5环境名称
发布到Azure web应用程序时,最好在哪里为每个ASP.NET 5 web应用程序部署设置环境名称 我知道需要设置Azure Web App中的ASP.NET 5环境名称,azure,azure-web-app-service,asp.net-core,asp.net-core-mvc,dnx,Azure,Azure Web App Service,Asp.net Core,Asp.net Core Mvc,Dnx,发布到Azure web应用程序时,最好在哪里为每个ASP.NET 5 web应用程序部署设置环境名称 我知道需要设置ASPNET\u DEV环境变量。这在发布时可能吗 这是我们的powershell发布脚本: param($websiteName, $packOutput) $website = Get-AzureWebsite -Name $websiteName # get the scm url to use with MSDeploy. By default this will
ASPNET\u 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门户中设置了环境变量?这会在部署之间持续吗
如果有必要,我将ASP.NET 5 beta6库与dnx451目标框架一起使用。应用程序设置在部署之间肯定会保持不变,它们是区分云中环境的一种很好的方法 我在2012年写了一篇关于这个的博客文章 发布到Azure web应用程序时,最好在哪里为每个ASP.NET 5 web应用程序部署设置环境名称 @科里·福勒是对的。使用应用程序设置设置环境名称。至少有四种方法可以做到这一点 浏览>所有资源>MyApp>设置>应用程序设置 Web应用程序>MyApp>配置>应用程序设置
如您所见,使用PowerShell比使用CLI更为棘手。注意:安装Azure PowerShell后重新启动控制台窗口。在每个服务器/Azure应用程序中设置一次环境变量。您不需要在每次发布时部署变量。注意:manage.windowsazure.net门户已被删除。
npm install -g azure-cli
azure account download
azure account import '~\Downloads\my-credentials.publishsettings'
site appsetting add ASPNET_ENV=Test MyApp
azure site appsettings list MyApp
choco install -y windowsazurepowershell
Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile '~\Downloads\my-credentials.publishsettings'
$hash = (Get-AzureWebsite -Name "MyApp").AppSettings
$hash.Add("ASPNET_ENV", "Test")
Set-AzureWebsite -Name "MyApp" -AppSettings $hash