我试图使用外部配置文件来定义我的web.config文件的根<configuration>
节内有多个location
元素的一部分。这可能吗?外部配置文件进行配置部分
我知道如何为单个部分(例如connectionStrings
),但是可以在此为配置元件内的多个元件来实现这样做呢? <configuration>
;本身不允许configSource
属性。是否有可能创建一个虚拟元素并在configSections
中定义它,如果是的话,我会给它一个类型?
背景资料:我想这样做,这样我可以定义永久重定向,可能有数百人因此,最好我不想在web.config中本身来定义这一点。即
<configuration>
<!-- rest of web.config here -->
<!-- i need mutiple location elements so want these in an external file-->
<location path="oldpage">
<system.webServer>
<httpRedirect enabled="true" destination="/uk/business" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
谢谢 - 我想我的问题可能会受到严重的措辞,这是什么,我知道该怎么做的例子,但我不使用重写部分我想将位置元素添加到配置部分。我会用一个例子更新我的问题。 – deadcrab 2012-04-16 13:10:57