我正在按照此链接 Deploy Asp.Net Web App To Azure VM中的教程来将我的 Asp.Net Web 应用程序部署到 Azure VM。我的源代码在 VSTS 中。我正在为虚拟机使用资源组部署模型。我能够成功运行“Azure 资源组部署任务”和“Azure 文件复制”任务。这些文件显示在临时文件夹中。但是,用于部署包的 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