2010-08-27 57 views
0

我在本地IIS 7.5上运行.net framework 4 Web应用程序项目,并安装了URL Rewrite 2.0模块。为什么Url Rewrite 2.0不起作用?

我的应用程序包含一个名为sitemap.aspx的页面。我希望能够映射/站点地图/到sitemap.aspx

这是我的代码到目前为止,它不起作用。在调用/ sitemap时,我会得到一个404 Not Found错误屏幕。什么不见​​了?

<rewrite> 
     <rules> 
      <rule name="LowerCaseRule1" enabled="true" stopProcessing="true"> 
       <match url="[A-Z]" ignoreCase="false" /> 
       <conditions> 
        <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true" /> 
       </conditions> 
       <action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" /> 

      </rule> 
      <rule name="RemoveTrailingSlashRule1" stopProcessing="true" enabled="true"> 
       <match url="(.*)/$" /> 
       <conditions> 
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
       </conditions> 
       <action type="Redirect" url="{R:1}" /> 
      </rule> 
     </rules> 
     <rewriteMaps> 
      <rewriteMap name="test"> 
       <add key="/sitemap" value="sitemap.aspx"/> 
      </rewriteMap> 
     </rewriteMaps> 
    </rewrite> 

回答

0

我缺少的部分的条目:

添加

 <rule name="Rewrite rule1 for test"> 
      <match url=".*" /> 
      <conditions> 
       <add input="{test:{REQUEST_URI}}" pattern="(.+)" /> 
      </conditions> 
      <action type="Rewrite" url="{C:1}" appendQueryString="false" /> 
     </rule> 

,一切工作正常