将 Asp.Net 个应用程序部署到 Azure VM
Deploy Asp.Net app to Azure VM
我正在学习此 link 中的教程
Deploy Asp.Net Web App To Azure VM 将我的 Asp.Net 网络应用程序部署到 Azure VM。我的源代码在 VSTS 中。我正在为虚拟机使用资源组部署模型。我能够成功地 运行 "Azure Resource Group Deployment Task" 和 "Azure File Copy" 任务。这些文件显示在临时文件夹中。然而,用于部署包的 powershell 脚本 ConfigureWebserver.ps1 似乎不包含任何关于它需要部署到哪个网站的信息。 Web 服务器创建了多个网站。如何修改脚本以部署到我的网站 "mysite.com" 而不是默认网站。
powershell 脚本
Configuration Main
{
Node ('localhost')
{
WindowsFeature WebServerRole
{
Name = "Web-Server"
Ensure = "Present"
}
WindowsFeature WebAspNet45
{
Name = "Web-Asp-Net45"
Ensure = "Present"
Source = $Source
DependsOn = "[WindowsFeature]WebServerRole"
}
#script block to download WebPI MSI from the Azure storage blob
Script DownloadWebPIImage
{
GetScript = {
@{
Result = "WebPIInstall"
}
}
TestScript = {
Test-Path "C:\temp\wpilauncher.exe"
}
SetScript ={
$source = "http://go.microsoft.com/fwlink/?LinkId=255386"
$destination = "C:\temp\wpilauncher.exe"
Invoke-WebRequest $source -OutFile $destination
}
}
Package WebPi_Installation
{
Ensure = "Present"
Name = "Microsoft Web Platform Installer 5.0"
Path = "C:\temp\wpilauncher.exe"
ProductId = '4D84C195-86F0-4B34-8FDE-4A17EB41306A'
Arguments = ''
DependsOn = @("[Script]DownloadWebPIImage")
}
Package WebDeploy_Installation
{
Ensure = "Present"
Name = "Microsoft Web Deploy 3.6"
Path = "$env:ProgramFiles\Microsoft\Web Platform Installer\WebPiCmd-x64.exe"
ProductId = '{ED4CC1E5-043E-4157-8452-B5E533FE2BA1}'
Arguments = "/install /products:ASPNET45,ASPNET_REGIIS_NET4,WDeploy /AcceptEula"
DependsOn = @("[Package]WebPi_Installation")
}
Script DeployWebPackage
{
DependsOn = @("[Package]WebDeploy_Installation")
GetScript = {
@{
Result = ""
}
}
TestScript = {
$false
}
SetScript = {
$MSDeployPath = (Get-ChildItem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -Last 1).GetValue("InstallPath") + "msdeploy.exe"
cmd.exe /C $("`"{0}`" -verb:sync -source:package={1} -dest:auto,ComputerName=localhost 2> C:\temp\err.log" -f $MSDeployPath, "F:\temp\mysite.zip")
}
}
}
}
Main
在 DeployWebPackage 资源的 SetScript 中,在 -dest
参数后添加以下参数:
-setParam:'IIS Web Application Name'=mysite.com
我正在学习此 link 中的教程 Deploy Asp.Net Web App To Azure VM 将我的 Asp.Net 网络应用程序部署到 Azure VM。我的源代码在 VSTS 中。我正在为虚拟机使用资源组部署模型。我能够成功地 运行 "Azure Resource Group Deployment Task" 和 "Azure File Copy" 任务。这些文件显示在临时文件夹中。然而,用于部署包的 powershell 脚本 ConfigureWebserver.ps1 似乎不包含任何关于它需要部署到哪个网站的信息。 Web 服务器创建了多个网站。如何修改脚本以部署到我的网站 "mysite.com" 而不是默认网站。
powershell 脚本
Configuration Main
{
Node ('localhost')
{
WindowsFeature WebServerRole
{
Name = "Web-Server"
Ensure = "Present"
}
WindowsFeature WebAspNet45
{
Name = "Web-Asp-Net45"
Ensure = "Present"
Source = $Source
DependsOn = "[WindowsFeature]WebServerRole"
}
#script block to download WebPI MSI from the Azure storage blob
Script DownloadWebPIImage
{
GetScript = {
@{
Result = "WebPIInstall"
}
}
TestScript = {
Test-Path "C:\temp\wpilauncher.exe"
}
SetScript ={
$source = "http://go.microsoft.com/fwlink/?LinkId=255386"
$destination = "C:\temp\wpilauncher.exe"
Invoke-WebRequest $source -OutFile $destination
}
}
Package WebPi_Installation
{
Ensure = "Present"
Name = "Microsoft Web Platform Installer 5.0"
Path = "C:\temp\wpilauncher.exe"
ProductId = '4D84C195-86F0-4B34-8FDE-4A17EB41306A'
Arguments = ''
DependsOn = @("[Script]DownloadWebPIImage")
}
Package WebDeploy_Installation
{
Ensure = "Present"
Name = "Microsoft Web Deploy 3.6"
Path = "$env:ProgramFiles\Microsoft\Web Platform Installer\WebPiCmd-x64.exe"
ProductId = '{ED4CC1E5-043E-4157-8452-B5E533FE2BA1}'
Arguments = "/install /products:ASPNET45,ASPNET_REGIIS_NET4,WDeploy /AcceptEula"
DependsOn = @("[Package]WebPi_Installation")
}
Script DeployWebPackage
{
DependsOn = @("[Package]WebDeploy_Installation")
GetScript = {
@{
Result = ""
}
}
TestScript = {
$false
}
SetScript = {
$MSDeployPath = (Get-ChildItem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -Last 1).GetValue("InstallPath") + "msdeploy.exe"
cmd.exe /C $("`"{0}`" -verb:sync -source:package={1} -dest:auto,ComputerName=localhost 2> C:\temp\err.log" -f $MSDeployPath, "F:\temp\mysite.zip")
}
}
}
}
Main
在 DeployWebPackage 资源的 SetScript 中,在 -dest
参数后添加以下参数:
-setParam:'IIS Web Application Name'=mysite.com