2016-07-14 112 views
0

我從這個鏈接 Deploy Asp.Net Web App To Azure VM以下教程到我的Asp.Net web應用程序部署到Azure中的VM。我的源代碼在VSTS中。我正在使用虛擬機的資源組部署模型。我能夠運行「天青資源組部署任務」和「Azure的文件複製」任務成功。這些文件顯示在臨時文件夾中。然而PowerShell腳本ConfigureWebserver.ps1部署包似乎並不包含哪個網站,它需要部署到任何信息。 Web服務器有多個創建的網站。如何修改腳本部署到我的網站「mysite.com」,而不是默認的Web站點。部署Asp.Net應用到Azure的VM

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 

回答

0

在你SetScript爲DeployWebPackage資源,在-dest參數後添加以下參數:

-setParam:'IIS Web Application Name'=mysite.com 
+0

其實,我結束了使用參數文件提供PARAMS但這也會起作用。 – BeesNees