IIS Web服务器支持高并发设置方法详解

2019-10-16 17:46:38刘景俊

在Url Rewrite Module中增加如下的规则:


<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>