IIS 5.0/6.0/7.x/8.x/10.0 通用八大效能調校動作,實測可提升 20~40% 輸送量:
<system.webServer><caching enabled="true" maxCacheSize="1000" /></system.webServer><staticContent><clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" /></staticContent>aspnet.config 設定 <processModel enable="true" maxWorkerThreads="100" maxIoThreads="100" /> (舊版)。<compilation debug="false" />、<httpRuntime fcnMode="Disabled" />、移除 trace.axd。<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"><scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /><scheme name="br" dll="%Windir%\system32\inetsrv\brotli.dll" /> (Win 10/Server 2019+)# 1. Keep-Alive
curl -I -H "Connection: keep-alive" https://example.com/ | grep -i "connection: keep-alive"
# 2. 壓縮
curl -I -H "Accept-Encoding: gzip, br" https://example.com/style.css | grep -i "content-encoding"
# 3. 快取標頭
curl -I https://example.com/script.js | grep -i "cache-control"
# 4. 偵錯旗標
grep -r "debug=\"true\"" C:\inetpub\wwwroot\web.config
依序套用、驗證、負載測試 (wrk/k6/JMeter),即可獲得穩定高效的 IIS 服務。