2009/1/17 21:03:03 | Intelligencia.UrlRewriter 转到iis7的URL Rewrite Module需要注意的问题
昨天从IIS6升级到IIS7,乐乎原有的Intelligencia.UrlRewriter我也换成了IIS7本身的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中很少出现。具体情况还需要测试。
另:
Microsoft URL Rewrite Module 下载地址:
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1692
Microsoft URL Rewrite Module Configuration的说明
http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/
查阅更多相关主题的贴子: Intelligencia.UrlRewriter URLRewriteModule iis7
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中很少出现。具体情况还需要测试。
另:
Microsoft URL Rewrite Module 下载地址:
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1692
Microsoft URL Rewrite Module Configuration的说明
http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/
0


评论
发布者 sepheric
2009/1/17 21:15:09
竟然改动这么大。我要改死了。
发布者 半点初心
2010/1/5 15:30:19
试了个 还是不行。。。
《RewriterConfig》
大叔帮我看看这个这么改够吗?
《Rules》
《Rule name="op" stopProcessing="true"》
《match url="^/List1_(\d+)\.aspx" /》
《action type="Rewrite" url="^/List.aspx?ClassID={R:1}" /》
《/Rule》
《/Rules》
《/RewriterConfig》
此贴由 半点初心 在 2010/1/5 15:47:06 进行编辑...
发布者 半点初心
2010/1/5 15:46:13
发布者 天凉好个秋
2010/1/7 13:42:44