Adds pre-flight checks for AdminSiteName/AdminAppPool at the top of deploy-iis-remote-apply.ps1 (same pattern as the public site), so a wrong name fails fast with a clear error instead of silently skipping the stop and leaving files locked for the wipe.master
| @@ -78,6 +78,14 @@ if(!(Get-Website -Name $SiteName -ErrorAction SilentlyContinue)){ | |||||
| if(!(Test-Path ('IIS:\AppPools\' + $AppPool))){ | if(!(Test-Path ('IIS:\AppPools\' + $AppPool))){ | ||||
| throw "App pool '$AppPool' does not exist yet. Create it once manually before running this deploy." | 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" | Write-Host "Stopping IIS site $SiteName and app pool $AppPool" | ||||
| try { Stop-Website -Name $SiteName } catch { } | try { Stop-Website -Name $SiteName } catch { } | ||||
| @@ -134,9 +142,6 @@ Set-ItemProperty ('IIS:\AppPools\' + $AppPool) -Name enable32BitAppOnWin64 -Valu | |||||
| # --- Admin site --- | # --- Admin site --- | ||||
| $adminPublicDir = Join-Path $RemoteDir 'public-admin' | $adminPublicDir = Join-Path $RemoteDir 'public-admin' | ||||
| if(![string]::IsNullOrWhiteSpace($AdminSiteName) -and (Test-Path $adminPublicDir)){ | 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" | Write-Host "Configuring admin site $AdminSiteName" | ||||
| if(![string]::IsNullOrWhiteSpace($AdminAppPool)){ | if(![string]::IsNullOrWhiteSpace($AdminAppPool)){ | ||||
| Set-ItemProperty ('IIS:\Sites\' + $AdminSiteName) -Name applicationPool -Value $AdminAppPool | Set-ItemProperty ('IIS:\Sites\' + $AdminSiteName) -Name applicationPool -Value $AdminAppPool | ||||
Powered by TurnKey Linux.