在項目的Web.config文件中確保有以下配置節
1. <configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
2. <system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
3.在IIS7路由不成功的主要原因是缺少以下的配置節
<system.webServer>
<httpProtocol>
<customHeaders>
<!--Compatible IE8-->
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="ExtensionlessUrlHandler-ISAPI-2.0_64bit" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64"
/>
<add name="ExtensionlessUrlHandler-ISAPI-2.0_32bit" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32"
/>
</handlers>
</system.webServer>
以上的配置節IIS7的也可以在窗體中添加
附:
源碼下載地址:https://github.com/sethyates/urlrewriter
支持html後綴的配置方法:http://urlrewriter.net/index.php/support/installation/windows-server-2003