C# 为什么Url重写2.0不起作用?

C# 为什么Url重写2.0不起作用?,c#,asp.net,iis-7.5,url-rewriting,C#,Asp.net,Iis 7.5,Url Rewriting,我正在本地IIS 7.5上运行一个.net framework 4 web应用程序项目,其中安装了URL重写2.0模块 我的应用程序包含一个名为sitemap.aspx的页面。我希望能够将/sitemap/映射到sitemap.aspx 到目前为止,这是我的代码,它不起作用。调用/sitemap后,我将看到一个404未找到错误屏幕。少了什么 <rewrite> <rules> <rule name="LowerCaseR

我正在本地IIS 7.5上运行一个.net framework 4 web应用程序项目,其中安装了URL重写2.0模块

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

到目前为止,这是我的代码,它不起作用。调用/sitemap后,我将看到一个404未找到错误屏幕。少了什么

   <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>

我在部分中缺少一个条目:


一切正常

        <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>