使用URLRewrite,部署网站到windows 2003,首页访问不了,其他页面都可以
C#写的网站,.net2.0,使用URLRewrite后,首页访问不了
配置IIS的默认首页或者配置规则都不行,首页规则如下:
<RewriterRule>
<LookFor>~/</LookFor>
<SendTo>~/default.aspx</SendTo>
</RewriterRule>
其他页面都访问正常,配置规则如下:
<RewriterRule>
<LookFor>~/([a-zA-Z0-9]+)/</LookFor>
<SendTo>~/123.aspx?p1=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/([a-zA-Z0-9]+)/(\d+).html</LookFor>
<SendTo>~/123.aspx?p1=$1&p2=$2</SendTo>
</RewriterRule>
httpHandlers配置如下:
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
如果加上path="*",首页访问不了,报“未将对象引用设置到对象的实例”的错误,找不到页面
如果去掉,首页可以正常访问,这种规则<LookFor>~/([a-zA-Z0-9]+)/</LookFor>的页面访问不了
配置环境是windows server 2003+IIS6 ,希望有高手支招,非常感谢!!!