目的:释放 IIS 内存

办法:设置定时任务

解决办法:C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:”DefaultAppPool”

DefaultAppPool 就是你要回收的池


还有一种办法是 VBS 脚本

Recyclepool.vbs 文件内容:

appPoolName = WScript.Arguments(0)

Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

Set oAppPool = oWebAdmin.Get("ApplicationPool.)

oAppPool.Recycle

set fso=createobject("scripting.filesystemobject")

if (fso.fileexists("d:\appPool\recycleIISPool.log")) then

   '1-forreading,2-forwriting,8-appending

   set file=fso.opentextfile("d:\appPool\recycleIISPool.log",8,ture)

else

   set file=fso.createtextfile("d:\appPool\recycleIISPool.log",8,ture)

end if

'write(x) 写入 x 个字符,writeline 写入换行,writeblanklines(n) 写入 N 个空行

file.writeline  now&"应用程序池 “"&appPoolName &"” 已经回收成功。"

file.close

Recyclepool.bat 文件内容:

cscript D:\appPool\recyclepool.vbs platweb


IIS 站点:

停止站点: 
C:\Windows\System32\inetsrv\appcmd.exe stop site “XXXX” 
启动站点: 
C:\Windows\System32\inetsrv\appcmd.exe start site “XXXX”

注:XXXX 就是 IIS 的网站名称 

应用程序池:

单独停止 “应用程序池”: 
C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:”XXXX”
单独启动 “应用程序池”: 
C:\Windows\System32\inetsrv\appcmd.exe start apppool /apppool.name:”XXXX”
单独回收 “应用程序池”:
C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:”XXXX”

XXXX 就是 IIS 的应用程序池的名称