IIS7 urlrewrite 模块 - 外部 xml 文件中的规则 [英] IIS7 urlrewrite module - Rules in external xml file

查看:18
本文介绍了IIS7 urlrewrite 模块 - 外部 xml 文件中的规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 IIS7 UrlRewrite 模块.我在 web.config 部分设置了我的规则.我想知道是否有办法在一个外部 xml 文件而不是 web.config 文件中定义规则.谢谢.

I'm using IIS7 UrlRewrite module. I set up my rules in the web.config <system.webServer><rewrite> section. I want to know if there's a way to define the rules in one external xml file instead of in web.config file. Thanks.

推荐答案

是的,您可以使用 configSource 属性来指向外部文件,就像使用其他 web.config 部分一样.在 web.config 中:

Yes, you can use the configSource attribute to point to an external file like you can with other web.config sections. In the web.config:

<rewrite>
    <rules configSource="Rewrite.config" />
</rewrite>

在规则配置文件中:

<rules>
    <rule name="some rule">
        <!-- rule details here --->
    </rule>
</rules>

您甚至还可以使用 IIS 管理器来编辑规则,它会正常工作.这种方法的一个小警告:当您进行更改并像这样保存外部文件时,它不会像更改 web.config 那样回收应用程序.因此,如果您正在编辑规则并希望看到它生效,您需要通过编辑并保存来手动戳 web.config.

You can still even use the IIS manager to edit rules and it'll just work. One minor caveat with this approach: when you make a change and save an external file like this, it will not recycle the application like making a change to the web.config will. So if you're editing a rule and want to see it take effect, you need to manually poke the web.config by making an edit and saving it.

另一个参考:将 IIS7 url 重写部分移出网络.配置文件

这篇关于IIS7 urlrewrite 模块 - 外部 xml 文件中的规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆