且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IIS WCF服务不使用的app.config

更新时间:2022-11-04 14:01:03

可以使用外部配置文件?

Can you use external configuration files?

您的web.config:

Your web.config:

<config>
  ...
  <connectionStrings configSource="myConnections.config"></connectionStrings>
</config>

然后你的外部myConnections.config文件:

And then your external myConnections.config file:

<connectionStrings>
  <add ... />
</connectionStrings>

您可以从您的主web.config文件中引用多个外部配置文件。看的见这篇博客对于如何/为什么这样做一个很好的解释。

You can have multiple external configuration files referenced from your main web.config file. See see this blog post for a nice explanation of how/why to do this.

我希望这有助于!