Is it possible to provide more settings for created application pool?

(Pavel Voronin) #1

Octopus documentation states that for the step “Deploy to IIS” Application pool is either created or reconfigured.

I would like to configure it with Start mode “AlwaysRunnigng” insted of “OnDemand”. Is it possible?

P.S. Cannot select category other than Support.

(Mark Siedle) #3

Hi Pavel,

Thanks for getting in touch.

While our “Deploy to IIS” step does not support this out-of-the-box, you could configure the “Custom Deployment Scripts” feature on the step and consider scripting this with PowerShell.

There are also some community step templates for IIS that may give you more options, or you could even use these as inspiration for scripting/setting your own start mode with PowerShell. For example, this community step has a Start Mode parameter (AppPoolStartMode), and if you click the “Show script” link and inspect the PowerShell code, you can see how it’s setting the start mode.

You could modify this script accordingly and experiment for your needs. Something along these lines may work (untested) - Note the TODOs you’d need to replace throughout the code:

[System.Reflection.Assembly]::LoadFrom('C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll')
Add-PSSnapin WebAdministration -ErrorAction SilentlyContinue
Import-Module WebAdministration -ErrorAction SilentlyContinue

$appPoolName = 'TODO'

$iis = (New-Object Microsoft.Web.Administration.ServerManager)
$pool = $iis.ApplicationPools | Where-Object {$_.Name -eq $appPoolName} | Select-Object -First 1
if ($pool -eq $null) {
    Write-Output ('Failed to find application pool {0}' -f $appPoolName)
	Exit
}
Execute-Retry {
    $iis = (New-Object Microsoft.Web.Administration.ServerManager)
    $pool = $iis.ApplicationPools | Where-Object {$_.Name -eq $appPoolName} | Select-Object -First 1
	$pool.StartMode = 'TODO'
    $iis.CommitChanges()
}

Hope this helps.

Cheers
Mark

1 Like
(system) closed #4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.