.net - 每个 AppDomain 允许有多少个 app.config 文件?

标签 .net configuration

如果应用程序在单个 AppDomain 中运行,我希望有一种方法可以避免自定义配置文件。

最佳答案

来自Suzanne Cook's .NET CLR Notes :

App.Config Files:

As default the app config file of the default appdomain is in the process exe’s directory and named the same as the process exe + ".config". Also, note that a web.config file is an app.config - ASP.NET sets that as the config file for your appdomain.

To change the config file, set an AppDomainSetup.ConfigurationFile to the new location and pass that AppDomainSetup to your call to AppDomain.CreateDomain(). Then, run all of the code requiring that application config from within that new appdomain.

Note, though, that you won’t be able to choose the CLR version by setting the ConfigurationFile – at that point, a CLR will already be running, and there can only be one per process.

Application configuration files are per appdomain. So, you can set a ‘dll config’ by using the method above, but that means that it will be used for the entire appdomain, and it only gets one.

关于.net - 每个 AppDomain 允许有多少个 app.config 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45838/

相关文章:

.net - 使用 ILMerge 合并 .NET 3.5 和 .NET 2.0 程序集时出现问题

Spring:如何做透明的运行时可变属性配置

image - 在 Magento 中添加管理配置选项卡图像

c# - Rx 中的 "Exclusive"和 "Default"订阅模式

c# - 是否有内置的 c# 类来定义具有开始日期和结束日期的时间窗口?

c# - 为什么我的 HTTP Web 请求代码不发送请求?

php - Doctrine ODM 在运行时选择数据库

c# - 如何解决 "Native DLL libmbusmaster.dll is missing! Please deploy the DLL file into the same directory as mbusmaster.net.dll."的问题

c# - Entity Framework Code First - 在另一个文件中配置

amazon-web-services - 为 cloudwatchLogs 中的每个日志文件创建一个 logStream