Asp.net URL Rewriter.NET web.config节点问题

Asp.net URL Rewriter.NET web.config节点问题,asp.net,url-rewriting,urlrewriter.net,Asp.net,Url Rewriting,Urlrewriter.net,我正在使用(与URL Rewriting.NET相比,我非常喜欢它——似乎更具版本性,请不要误会,我喜欢URL Rewriting.NET,但鉴于我对该工具的了解,它似乎不能满足需要)。我正在尝试使用节点重新定义站点的默认文档。我已尝试将其添加到“重写器”节点,但出现web.config错误 Description: An error occurred during the processing of a configuration file required to service this r

我正在使用(与URL Rewriting.NET相比,我非常喜欢它——似乎更具版本性,请不要误会,我喜欢URL Rewriting.NET,但鉴于我对该工具的了解,它似乎不能满足需要)。我正在尝试使用节点重新定义站点的默认文档。我已尝试将其添加到“重写器”节点,但出现web.config错误

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: The element 'default-documents' is not allowed.

Source Error: 


Line 187:
Line 188:   <rewriter>
Line 189:       <default-documents>
Line 190:           <document>default.aspx</document>
Line 191:           <document>index.aspx</document>
Description:处理此请求所需的配置文件时出错。请查看下面的特定错误详细信息,并适当修改配置文件。
分析器错误消息:不允许使用元素“默认文档”。
源错误:
第187行:
第188行:
第189行:
第190行:default.aspx
第191行:index.aspx
过去是否有人使用过此工具,是否有人知道将此节点放置在何处(或正确使用)

编辑:

我尝试了下面的建议,但似乎不太管用。这是我的额外配置文件中的内容(这是配置文件中唯一的内容)


default.aspx
index.aspx

我以前使用过urlrewriter,在实际设置默认文档时也遇到了一些问题。然而,最终我们通过将urlrewriter配置移动到与web.config不同的配置文件中,使它(以及其他一些小麻烦)得以工作

<rewriter configSource="urlrewriter.config"/>

请记住,您还必须禁用IIS中的默认文档,URLRewiter才能正常工作。这也造成了一系列令人讨厌的问题

编辑:别忘了将这一行添加到web.config中的配置部分

<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>


希望这能有所帮助。

这段代码对我很有用:

    <configSections>
        <section name="rewriter" 
                 requirePermission="false" 
                 type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" 
        />
    </configSections>

    <rewriter>
        <default-documents>
            <document>index.aspx</document>
        </default-documents>
    </rewriter>

index.aspx
编辑:确保在添加通配符应用程序映射的位置也未选中“验证文件存在”。如果不这样做,默认文档将不会做任何事情


另一个编辑:找到了说明“验证文件是否存在”复选框的安装步骤。参见第8步:

我相信这个问题的解决方案是我在网站上使用的.NET版本。我使用的是2.0运行时,dll是为1.1运行时构建的。我在网站上看到2.0运行时仍然在RC中(从2007年年中开始),因此我不会在这个生产网站上使用它。相反,我想出了如何使用URL Rewriting.NET来实现同样的目标

我添加了以下规则:

<add name="Redirect54" virtualUrl="~/content/myvirtualpage.aspx"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="~/content/mydestinationpage.aspx?id=9"
    redirect="None"   
    ignoreCase="true"  />


这会导致myvirtualpage.aspx上出现HTTP 200响应,而不是重写。最终的目标是让mydestinationpage.aspx?id=9拥有一个301到myvirtualpage.aspx的连接,这将为myvirtualpage.aspx提供一个200 HTTP响应。不过这有点不对劲。

是否“似乎不太正常”是指“没有使用默认文档”?如果是这样,请检查下面的编辑。我在您和SirDemon的回复中列出了所有相同的配置部分。我在httpModules节点中找到了行。我有常规的重写节点工作得很好。只有默认文档节点不起作用。请检查我的编辑。在添加通配符应用程序映射的地方,还未选中“验证文件是否存在”?否则,它不会执行默认文档..是的,我检查了IIS设置。这似乎并没有解决问题。我认为这是正在使用的运行时。我使用的是.NET2.0版本,没有问题。希望你能弄明白。将它添加到单独的配置文件并不能解决问题。事实上,我相信我也使用了2.0版本,而且它也能工作,尽管正如我之前所说,我们最终克服了一些恼人的错误。
<add name="Redirect54" virtualUrl="~/content/myvirtualpage.aspx"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="~/content/mydestinationpage.aspx?id=9"
    redirect="None"   
    ignoreCase="true"  />