在很久以前,也就是.Net 1.0的时代,我们查到说w3wp.exe跑到850MB就会崩溃。到了IIS6.0的时代,监控下来,到了850MB就会开始回收。所以大家一直以为是850MB。其实这个认识是我们想当然的,是错误。答案是840MB开始,w3wp.exe就会开始回收。为什么是这个奇怪的数字?
原因是IIS的内存最大使用是1.2GB,如果你没改Machine.config的话,默认是60%的回收临界值,那么1.2GB乘以0.6,得到的结果就是840MB。我们怎么让w3wp.exe突破840MB呢?
修改Machine.config的一个节点。将memoryLimit的值设置为更大的值,不过不建议更改。
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="machine"
password="AutoGenerate"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="200"
maxIoThreads="200"
/>