作为.net程序员,大家都知道,IIS有默认回收机制;
Sharepoint更是有多个应用池,且每天夜里都会默认回收;这也就造成了第二天为什么第一个打开站点的人,访问速度非常慢的原因了。解决此问题最好的办法就是预热
下面具体介绍通过Windows计划任务程序部署PowerShell脚本,来对SharePoint环境进行预热。
如下为预热代码,保存为.ps1文件
<#
.SYNOPSIS
Warm up SharePoint IIS W3WP memory cache by loading pages from WebRequest
.DESCRIPTION
Loads the full page so resources like CSS, JS, and images are included. Please modify lines 331-345
to suit your portal content design (popular URLs, custom pages, etc.)
Comments and suggestions always welcome! Please, use the issues panel at the project page.
.PARAMETER url
A collection of url that will be added to the list of websites the script will fetch.
.PARAMETER install
Typing "SPBestWarmUp.ps1 -install" will create a local Task Scheduler job under credentials of the
current user. Job runs every 60 minutes on the hour to help automatically populate cache.
Keeps cache full even after IIS daily recycle, WSP deployment, reboot, or other system events.
.PARAMETER installfarm
Typing "SPBestWarmUp.ps1 -farminstall" will create a Task Scheduler job on all machines in the farm.
.PARAMETER uninstall
Typing "SPBestWarmUp.ps1 -uninstall" will remove Task Scheduler job from all machines in the farm.
.PARAMETER skiplog
Typing "SPBestWarmUp.ps1 -skiplog" will avoid writing to the EventLog.
.PARAMETER allsites
Typing "