简体   繁体   English

是否可以让多个服务或应用程序共享一个配置文件

[英]Is it possible to have multiple services or applications share one single config file

如果我有多个共享一个配置值的应用程序或服务(例如,它们都访问同一个数据库),有没有办法让它们共享一个配置文件而不必在每个配置中复制值?

You could use the machine.config file to define settings shared between all applications on this computer. 您可以使用machine.config文件来定义此计算机上所有应用程序之间共享的设置。 For ASP.NET applications you could have a web.config file at the root of the file which overrides those machine.config values and have yet another level inside the virtual directory. 对于ASP.NET应用程序,您可以在文件的根目录下有一个web.config文件,该文件会覆盖这些machine.config值,并且在虚拟目录中还有另一个级别。

You can use the configSource attribute to point to a specific file. 您可以使用configSource属性指向特定文件。

Use the same file location from multiple .config files. 使用多个.config文件中的相同文件位置。

You can do this with multiple config sections, so one file for connection strings, one for app settings etc... 您可以使用多个配置部分执行此操作,因此一个文件用于连接字符串,一个用于应用程序设置等...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以在多个 git 存储库的根文件夹中共享单个文件? - Is it possible to share a single file in the root folder of multiple git repositories? 在C#中共享一个数据库的多个应用程序 - multiple applications that share one database in C# 是否可以在Xamarin.iOS中让多个类(无论是UITableViewCell还是UIViewController)共享一个xib? - Is it possible to have multiple classes (be it UITableViewCell or UIViewController) share a single xib in Xamarin.iOS? 在一个配置中配置多个WCF绑定或服务 - Configure multiple WCF bindings or services in one config 是否可以为多个参与者和/或服务提供一种解决方案? - Is it possible to have one solution for many actors and/or services? 与多个应用程序共享 HidDevice - Share HidDevice with multiple applications 可以在多个Windows服务之间共享缓存项吗? - Possible to share cache item amongst multiple windows services? 是否可以在多个项目之间共享ResourceDictionary文件? - Is it possible to share a ResourceDictionary file between multiple projects? 是否可以在Windows服务配置文件中设置全球化文化? - Is it possible to set the globalization culture in a windows services config file? 一个单一的实体类型可以有多个控制器吗? - Is it possible to have multiple controllers for a single entity type?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM