25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1KB

  1. [CmdletBinding()]
  2. param(
  3. [string]$SiteName = 'WscMvc',
  4. [string]$PoolName = 'WscMvc',
  5. [string]$PhysicalPath,
  6. [int]$Port = 8090
  7. )
  8. Import-Module WebAdministration
  9. if (-not $PhysicalPath) {
  10. $PhysicalPath = Split-Path -Parent $PSScriptRoot
  11. }
  12. if (-not (Test-Path "IIS:\AppPools\$PoolName")) {
  13. New-WebAppPool -Name $PoolName | Out-Null
  14. Set-ItemProperty "IIS:\AppPools\$PoolName" -Name managedRuntimeVersion -Value ''
  15. Set-ItemProperty "IIS:\AppPools\$PoolName" -Name enable32BitAppOnWin64 -Value $false
  16. Write-Output "Created app pool $PoolName (64-bit, no managed code)"
  17. } else {
  18. Write-Output "App pool $PoolName already exists"
  19. }
  20. if (-not (Test-Path "IIS:\Sites\$SiteName")) {
  21. New-Website -Name $SiteName -Port $Port -PhysicalPath $PhysicalPath -ApplicationPool $PoolName | Out-Null
  22. Write-Output "Created site $SiteName on port $Port -> $PhysicalPath"
  23. } else {
  24. Write-Output "Site $SiteName already exists"
  25. }
  26. Start-WebAppPool -Name $PoolName -ErrorAction SilentlyContinue
  27. Start-Website -Name $SiteName -ErrorAction SilentlyContinue
  28. Get-Website -Name $SiteName | Select-Object Name, State, PhysicalPath, ApplicationPool

Powered by TurnKey Linux.