ソースを参照

Validate admin site/app-pool exist before attempting to stop them

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
Daniel Covington 10時間前
コミット
c43b1120f5
1個のファイルの変更8行の追加3行の削除
  1. +8
    -3
      scripts/deploy-iis-remote-apply.ps1

+ 8
- 3
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


読み込み中…
キャンセル
保存

Powered by TurnKey Linux.