一个很重要的就是URL Rewrite模块是需要被安装才可以工作,你可以如下两个版本:
x86版本:http://www.iis.net/downloads/default.aspx?tabid=34&;g=6&i=1691
x64版本:http://www.iis.net/downloads/default.aspx?tabid=34&;g=6&i=1692
该模块(目前)只支持IIS7.0,你应该运行IIS7.0有利于使用它。如果你的项目是使用Visual Studio for Web Developers开发,那么项目应该配置成在iis7.0下运行,而不是其他的web服务器。
有关URL Rewrite模块的详细内容见:http://learn.iis.net/page.aspx/460/using-url-rewrite-module/
注意:
1.原来的$1换成{R:1},其他语法少许变化<rewrite url="~/test/([a-zA-Z0-9_-]+)/(d+).html?{0,1}(.*)$" to="~/test.aspx?id=$4&$5" processing="stop"/>
换成
<rule name="OrgPage" stopProcessing="true">
<match url="^test/([a-zA-Z0-9_-]+)/(d+).html?{0,1}(.*)$" />
<action type="Rewrite" url="test.aspx?id={R:1}&{R:2}" />
</rule>
2.UrlRewriter中 url="~/module/“ ,在URL Rewrite Module中必须换成^module/,否则就算test通过,在实际环境中也无法解析;
3.以前 UrlRewriter中 url="^/([a-zA-Z0-9_]+)“是可以的,但是在URL Rewrite Module中不行,必须添加参数
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^blog.lehu.shu.edu.cn$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
4.另外需要注意IIS6的config转换到iis7的时候,需要删除applicationHost.config中<handlers accessPolicy="Read, Script" />的多余参数,或者干脆重新建立,否则会出现很多奇怪的问题,我昨天为了这个搞了好几个小时,后来才发现问题。
总体上说,IIS7比IIS6稳定些了,到现在位置,IIS6中总是出现的缓冲池死在IIS7中很少出现。具体情况还需要测试。
规则定义截图:
Web.config中的规则定义:
<rewrite>
<rules>
<rule name="RequestBlockingRule1" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_REFERER}" pattern="^$" negate="true" />
<add input="{HTTP_REFERER}" pattern="^http://(.*.)?(cnblogs.com)/.*$" negate="true" />
</conditions>









