IIS Web服務器支持高并發(fā)設置方法詳解
適用的IIS版本:IIS 7.0, IIS 7.5, IIS 8.0
適用的Windows版本:Windows Server 2008, Windows Server 2008 R2, Windows Server 2012
1、應用程序池(Application Pool)的設置:
General->Queue Length設置為65535(隊列長度所支持的最大值)
Process Model->Idle Time-out設置為0(不讓應用程序池因為沒有請求而回收)
Recycling->Regular Time Interval設置為0(禁用應用程序池定期自動回收)
2、.Net Framework相關設置
a) 在machine.config中將
<processModel autoConfig="true" />
改為
<processModel enable="true" requestQueueLimit="100000"/>
(保存后該設置立即生效)
b) 打開C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers\Default.browser,找到<defaultBrowser id="Wml" parentID="Default" >,注釋<capabilities>部分,然后運行在命令行中運行aspnet_regbrowsers -i。
<defaultBrowser id="Wml" parentID="Default" >
<identification>
<header name="Accept" match="text/vnd\.wap\.wml|text/hdml" />
<header name="Accept" nonMatch="application/xhtml\+xml; profile|application/vnd\.wap\.xhtml\+xml" />
</identification>
<!--
<capabilities>
<capability name="preferredRenderingMime" value="text/vnd.wap.wml" />
<capability name="preferredRenderingType" value="wml11" />
</capabilities>
-->
</defaultBrowser>
以解決text/vnd.wap.wml問題。
3、IIS的applicationHost.config設置
設置命令:
c:\windows\system32\inetsrv\appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000
設置結(jié)果:
<serverRuntime appConcurrentRequestLimit="100000" />
(保存后該設置立即生效)
4、http.sys的設置
注冊表設置命令1(將最大連接數(shù)設置為10萬):
reg add HKLM\System\CurrentControlSet\Services\HTTP\Parameters /v MaxConnections /t REG_DWORD /d 100000
注冊表設置命令2(解決Bad Request - Request Too Long問題):
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters /v MaxFieldLength /t REG_DWORD /d 32768
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters /v MaxRequestBytes /t REG_DWORD /d 32768
(需要在命令行運行 net stop http & net start http & iisreset 使設置生效)
5、針對負載均衡場景的設置
在Url Rewrite Module中增加如下的規(guī)則:
<rewrite>
<allowedServerVariables>
<add name="REMOTE_ADDR" />
</allowedServerVariables>
<globalRules>
<rule name="HTTP_X_Forwarded_For-to-REMOTE_ADDR" enabled="true">
<match url=".*" />
<serverVariables>
<set name="REMOTE_ADDR" value="{HTTP_X_Forwarded_For}" />
</serverVariables>
<action type="None" />
<conditions>
<add input="{HTTP_X_Forwarded_For}" pattern="^$" negate="true" />
</conditions>
</rule>
</globalRules>
</rewrite>
6、 設置Cache-Control為public
在web.config中添加如下配置:
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" />
</staticContent>
</system.webServer>
</configuration>
相關文章
為IIS增加svg和woff等字體格式的MIME(2003、2008)
使用了字體文件來顯示矢量的圖標,為了能在IIS上正常顯示圖標,可以通過增加iis的MIME-TYPE來支持圖標字體文件2016-12-12IIS+PHP+MySQL環(huán)境中PHP.INI需要注意的幾個地方
一般我們在windows系統(tǒng)中,配置iis+php運行環(huán)境,需要注意的地方,大家可以參考下2013-02-02IIS服務器下安裝配置XCache緩存器方法及XCache下載
使用這個加速器可以很大程度的降低CPU占用(但會造成更多的內(nèi)存占用),并使網(wǎng)頁執(zhí)行時間縮短。具體原理不介紹了,網(wǎng)上有很多2012-01-01WINDOWS + WAMP + Zend Framework 配置步驟分享
WINDOWS + WAMP + Zend Framework 配置步驟分享,需要的朋友可以參考下。2011-07-07跟后臺打印程序系統(tǒng)服務通訊時出現(xiàn)錯誤解決方法
跟后臺打印程序系統(tǒng)服務通訊時出現(xiàn)錯誤。請打開服務管理單元,確認后臺打印程序服務是否在運行。2008-07-07WIN2003+IIS6 PHP 5.3.8安裝配置教程[圖文]
WIN2003+IIS6 PHP 5.3.8安裝配置圖文教程,需要的朋友可以參考下2012-09-09iis6網(wǎng)站屬性沒有asp.net選項卡的解決辦法
這篇文章主要介紹了iis6網(wǎng)站屬性沒有asp.net選項卡的解決辦法,一般是沒有安裝.NET Framework 2.0的原因造成的,本文同時給出另外幾種可能情況,需要的朋友可以參考下2014-08-08