diff --git a/scripts/deploy-iis-remote-apply.ps1 b/scripts/deploy-iis-remote-apply.ps1 index 74d9c6f..db6d223 100644 --- a/scripts/deploy-iis-remote-apply.ps1 +++ b/scripts/deploy-iis-remote-apply.ps1 @@ -78,6 +78,14 @@ if(!(Get-Website -Name $SiteName -ErrorAction SilentlyContinue)){ if(!(Test-Path ('IIS:\AppPools\' + $AppPool))){ throw "App pool '$AppPool' does not exist yet. Create it once manually before running this deploy." } +if(![string]::IsNullOrWhiteSpace($AdminSiteName)){ + if(!(Get-Website -Name $AdminSiteName -ErrorAction SilentlyContinue)){ + throw "IIS admin site '$AdminSiteName' does not exist yet. Create the site and app pool once manually before running this deploy." + } + if(![string]::IsNullOrWhiteSpace($AdminAppPool) -and !(Test-Path ('IIS:\AppPools\' + $AdminAppPool))){ + throw "Admin app pool '$AdminAppPool' does not exist yet. Create it once manually before running this deploy." + } +} Write-Host "Stopping IIS site $SiteName and app pool $AppPool" try { Stop-Website -Name $SiteName } catch { } @@ -134,9 +142,6 @@ Set-ItemProperty ('IIS:\AppPools\' + $AppPool) -Name enable32BitAppOnWin64 -Valu # --- Admin site --- $adminPublicDir = Join-Path $RemoteDir 'public-admin' if(![string]::IsNullOrWhiteSpace($AdminSiteName) -and (Test-Path $adminPublicDir)){ - if(!(Get-Website -Name $AdminSiteName -ErrorAction SilentlyContinue)){ - throw "IIS admin site '$AdminSiteName' does not exist yet. Create the site and app pool once manually before running this deploy." - } Write-Host "Configuring admin site $AdminSiteName" if(![string]::IsNullOrWhiteSpace($AdminAppPool)){ Set-ItemProperty ('IIS:\Sites\' + $AdminSiteName) -Name applicationPool -Value $AdminAppPool