[英]How to prevent IIS from recycling Application Pool when a worker process is unresponsive
[英]IIS Application Pool recycling Identity when using PowerShell script
今天,我正在尝试通过WCF Web服务的开发安装来使用PowerShell。 我正在使用在Windows Server 2012和IIS 8.5.96上执行的PowerShell脚本。
首先,我手动设置服务,只是为了确保一切正常,然后重新添加需要在脚本中包含的设置。 然后,我删除了应用程序池,网站和文件夹目录。
我已经运行了脚本,并且可以运行,但是每次运行时,它将使用我手动创建服务时使用的Identity
来设置应用程序池。
下面是到目前为止的脚本。 您可以看到我没有在任何地方指定应用程序池标识,因此我认为它必须存储在计算机上的某个位置。.但是我没有运气找到它(我已经在两个C
上都进行了搜索和D
驱动器,这是该服务器上仅有的两个分区)。
有什么想法/想法吗? #load IIS模块Import-Module WebAdministration Add-WindowsFeature Web脚本工具
#variables
$okeeffename = "OKeeffe"
$domain = "InsideServices.dev.com"
$okeeffeapppoolname = "OKeeffeApplicationPool"
$okeeffeiis = "IIS:\AppPools\$okeeffeapppoolname"
$logpath = "D:\SystemLogFiles\LogFiles"
$domainpath = "d:\webcontent\$domain"
$okeeffedirectory = "d:\webcontent\$domain\$okeeffename"
$okeeffestagingpath = "\\prdhilfs02\install\Monet\ServerUpgrade\DEVHILWB119\OKeeffe"
#create webcontent and application folders
Write-Host "Creating directories" -ForegroundColor Yellow
New-Item -Path $domainpath -type directory -ErrorAction Stop
New-Item -Path $okeeffedirectory -type directory -ErrorAction Stop
#create log folder, if it doesn't exist
if(-not (Test-Path -path $logpath))
{
New-Item -Path $logpath -type directory
}
#create app pool
if(-not (Test-Path -path $okeeffeiis))
{
#Write-Host "Creating app pool: $okeeffeapppoolname" -ForegroundColor Yellow
New-WebAppPool $okeeffeapppoolname -force -ErrorAction Stop
set runtime version
Set-ItemProperty "IIS:\AppPools\$okeeffeapppoolname" managedRuntimeVersion v4.0
}
我不太确定是什么导致使用以前的身份创建AppPool,但是也许您可以尝试立即在New-WebAppPool返回的ConfigurationElement对象上设置一些属性:
# Get reference to ConfigurationElement for AppPool...
$pool = New-WebAppPool $okeeffeapppoolname -force -ErrorAction Stop
$pool.processModel.identityType = "SpecificUser"
$pool.processModel.username = 'domain\username'
$pool.processModel.password = 'password'
$pool | Set-Item
参考: http : //forums.iis.net/t/1171615.aspx?如何+配置+应用程序+池+身份+自+ powershell +
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.