Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

IIS – no default pool recycle, set 1AM

Background

When SharePoint 2013 installs IIS application pools are created for content, service applications, central admin, and workflow.    Only the content pools appear to be given a daily recycle time.    However, I have noticed errors with Service Applications which can be fixed after recycling the pool.    Personally I prefer to recycle pools daily and ensure maximum stability.   Below is PowerShell code to accomplish that.  

shades_smile

 

image

 

Symptoms

  • Excel Services Web Part error visible to end users –  “We don’t know what happened, but something went wrong.  Could you please try that again?”
  • WCF errors on eventlog
  • Slow or unresponsive HTTP endpoints with “.svc”
image

Resolution

Apply 1AM IIS daily recycle time to any SharePoint pools without a schedule.

PowerShell Code

# Bypass IIS Defaults
$exclude=@(".NET v2.0",".NET v2.0 Classic",".NET v4.5",".NET v4.5 Classic","Classic .NET AppPool","DefaultAppPool");
# Loop SharePoint pools
$pools = Get-ChildItem IIS:\AppPools;
foreach ($p in $pools) {
	if (!$exclude.contains($p.name)) {
		$pn = $p.Name;
		$s = $p.recycling.periodicRestart.schedule.collection.value;
		if (!$s) {
			# Missing recycle schedule.  Set 1AM daily
			Set-ItemProperty -Path "IIS:\AppPools\$pn" -Name Recycling.periodicRestart.schedule -Value @{value="01:00"}}
		}
	}
}

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲