合并/继承web.config文件,但没有将站点作为子站点

时间:2021-04-05 11:31:10

I'd like to have the functionality of merging/inheriting the web.config of one site with that of a shared web.config, but without having the site being a child site of the site with the shared web.config.

我希望具有将一个站点的web.config与共享web.config的web.config合并/继承的功能,但是没有该站点是具有共享web.config的站点的子站点。

Is there a way to implement similar functionality?

有没有办法实现类似的功能?

What I'm trying to do have a shared web.config in any folder (could be outside of wwwroot). Then multiple sites under IIS will have their own web.configs which merge/inherit with the shared web.config. The aim is to have the site web.configs as non-cluttered as possible, maybe just app settings for company id and a reply email address.

我想要做的是在任何文件夹中都有一个共享的web.config(可能在wwwroot之外)。然后IIS下的多个站点将拥有自己的web.configs,它们与共享的web.config合并/继承。目的是让网站web.configs尽可能不凌乱,可能只是公司ID的应用程序设置和回复电子邮件地址。

1 个解决方案

#1


I would use the machine.config for the shared stuff.

我会使用machine.config来共享东西。

Or you can reference the shared web.config like this:

或者您可以像这样引用共享的web.config:

<appSettings file="../Support/config/WebEnvironment.config">
</appSettings>

And here I blog about when we moved all of our settings to a database table.

在这里,我将博客关于何时将所有设置移动到数据库表。

#1


I would use the machine.config for the shared stuff.

我会使用machine.config来共享东西。

Or you can reference the shared web.config like this:

或者您可以像这样引用共享的web.config:

<appSettings file="../Support/config/WebEnvironment.config">
</appSettings>

And here I blog about when we moved all of our settings to a database table.

在这里,我将博客关于何时将所有设置移动到数据库表。