是否可以将IIS7重写模块创建的规则从根网站配置文件移动到自己的Web配置文件中,就像您可以使用appsettings一样?如果可以,该怎么做?
是否可以将IIS7重写模块创建的规则从根网站配置文件移动到自己的Web配置文件中,就像您可以使用appsettings一样?如果可以,该怎么做?
我似乎无法让它正常工作,但它的描述方式是:
<rewrite>
<rewriteMaps configSource="external.config">
</rewriteMaps>
</rewrite>
然后在external.config文件中添加你的规则:
<rewriteMaps>
<rewriteMap ...
...
</rewriteMaps>
以下是我在web.config中的做法:
<system.webServer>
<rewrite>
<rules configSource="web.rules.config" />
</rewrite>
</system.webServer>
One cool thing is that the IIS Configuration Editor respects this external file when you edit the rules and writes the changes back to the external file.
If you put:
<system.webServer>
<rewrite configSource="web.rules.config" />
</system.webServer>
it won't work, you get HTTP error 500.19 Internal server error:
Error Code: 0x8007000d
Config Error: Unrecognized attribute 'configSource'
Can anyone point to the definitive MSDN help page on the rewrite
element and the configSource
attribute? The MSDN article on system.webServer does not mention the rewrite element and I can't find an MSDN page via google.
<rules />
元素被实现为具有configSource属性的SectionInformation,而<rewrite />
元素是不具有该属性的ConfigurationSection。