调整IIS 7应用程序池队列长度
由原来的默认1000改为65535。
Internet Information Services (IIS)管理器 > 应用程序池 > 当前需要修改的网站所对应的应用程序池 > 高级设置
队列长度 : 65535
@echo off
set newQueueLength=65535
REM 获取IIS安装路径
for /f "tokens=2 delims==" %%a in ('%windir%\system32\inetsrv\appcmd.exe list apppool ^| find "name:"') do (
set "appPoolName=%%~a"
%windir%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /[name='%appPoolName%'].queueLength:%newQueueLength%
)
echo 队列长度已修改为%newQueueLength%
调整IIS 7的appConcurrentRequestLimit设置
由原来的默认5000改为100000。
c:\windows\system32\inetsrv\appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000
在%systemroot%\System32\inetsrv\config\applicationHost.config中可以查看到该设置:
@echo off
set newLimit=100000
REM 获取IIS安装路径
for /f "tokens=2 delims==" %%a in ('%windir%\system32\inetsrv\appcmd.exe list config ^| find "APPLICATIONHOST.CONFIG"') do set "configPath=%%~a"
REM 设置appConcurrentRequestLimit
%windir%\system32\inetsrv\appcmd.exe set config "%configPath%" -section:system.webServer/serverRuntime /appConcurrentRequestLimit:%newLimit%
echo appConcurrentRequestLimit已修改为%newLimit%
调整IIS 7支持的同时TCPIP连接数
由原来的默认5000改为100000。
reg add HKLM\System\CurrentControlSet\Services\HTTP\Parameters /v MaxConnections /t REG_DWORD /d 100000
调整machine.config中的processModel>requestQueueLimit的设置
按Win+R键,在“运行”对话框中,键入 notepad %systemroot%\Microsoft.Net\Framework64\v2.0.50727\CONFIG\machine.config,然后单击“确定”。
查找"processModel"关键词,由原来的默认的配置
@echo off
set "configPath=%systemroot%\Microsoft.Net\Framework64\v2.0.50727\CONFIG\machine.config"
set "newLimit=100000"
REM 使用临时文件存储修改后的内容
set "tempFile=%temp%\machine.config.tmp"
REM 逐行读取配置文件并进行替换
(for /f "tokens=*" %%a in ('type "%configPath%"') do (
set "line=%%a"
REM 查找包含<processModel的行
echo !line! | find "<processModel" > nul
if not errorlevel 1 (
REM 替换为新的配置
set "line=<processModel enable=\"true\" requestQueueLimit=\"%newLimit%\"/>"
)
REM 输出修改后的行到临时文件
echo !line!
)) > "%tempFile%"
REM 将临时文件覆盖原始配置文件
move /y "%tempFile%" "%configPath%" > nul
echo processModel>requestQueueLimit已修改为%newLimit%
运行命令使设置生效
net stop http & net start http & iisreset