目的:釋放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.Name='" + appPoolName + "'") 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的應用程序池的名稱