问题标签 [configsource]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
4274 浏览

.net - Using configSource, and changing restartOnExternalChanges for core section

I'd like to use the configSource attribute of my web config section to define external files for various settings.

Particularly, the appSettings section. This means my config file has the following entry:

However, if this file is updated, the settings are not automatically picked up, which would have been the case if the settings were manually included in the web.config

Further investigation lead me to the restartOnExternalChanges attribute. This can apparently be used with <section/> elements to define whether externals files identified by configSource can trigger restarts or not. Great! or so I thought.

However, when trying to define the appSettings section, and changing the restartOnExternalChanges value, I see the same error encountered here, because the appSettings section is defined in the machine.config - a file I cannot change.

Does anyone know if its possible to get these two settings to work together, for sections already defined at a higher-level?

0 投票
1 回答
139 浏览

installation - 配置源和安装程序

我有一个项目 csproj,带有 app.config 文件,并使用 configsource 属性记录 Ent.Library 部分。日志记录部分位于另一个文件 Config\loggingconfiguration.config 中。

我有这个 csproj 的安装程序项目。但是当我生成时,文件 loggingconfiguration.config 不包括在内。

有什么建议么?

0 投票
1 回答
1525 浏览

asp.net - 是否可以在 web.config 中的自定义 ConfigurationElement 类上使用 configSource 属性?

我知道可以为配置部分引用外部配置文件,但我想更进一步,从配置元素中引用配置文件。

IE

<CustomConfigSection>
<Plugins>
<Plugin configSource="plugin.config"/>
<Plugin configSource="another_plugin.config"/>
</Plugins>
</CustomConfigSection>

0 投票
1 回答
1169 浏览

asp.net - 在 web.config 中使用动态生成的文件作为 configSource

有没有办法将生成的文件用作 web.config 部分的 configSource?

在 web.config 中,我尝试了一个简单的方法:

其中 webpartsConfig.aspx 只是在正常访问时吐出 XML,而不是作为 configSource。(文字源代码按原样包含,给出错误。)任何解决方案或替代方案?

这个解决方案的动机:我在本地和在线有不同的配置变量,我不想处理多个配置文件。

0 投票
0 回答
111 浏览

iis-7 - IIS7 管理器不维护 configSource 参考

我使用 ConfigSource=localfile 将我的连接字符串保存在生产服务器上的单独文件中。这很好用。

但是,如果您使用 IIS7 管理器在服务器上编辑连接字符串,这些字符串最终会回到 web.config 中。当新的 web.config 到达时,后续部署会丢弃这些编辑。

II7,如果它编辑您的连接(或应用程序设置)字符串,应将它们放回它们来自的文件中。

不?

实际上,甚至似乎在这个序列中的某个地方,原始本地文件被截断(仅在 xml 文件中的标题行)......然后在下一次部署后出错。

0 投票
2 回答
4212 浏览

web-config - 带有 elmah 的外部配置文件

我正在使用 elmah (v1.1.11517.0) 并试图将配置移动到外部源。

我的配置目前看起来像这样:

log4net 很高兴并且运行良好,但是对于 elmah 我得到了错误

这很痛苦,elmah 文件肯定在那里,但有些不开心。

这可能是什么原因造成的?

0 投票
1 回答
246 浏览

.net - 在 Windows Server 2003 中通过 configSource 访问 AppSettings 时出现问题

根据MSDN 文档configSource在 Windows Server 2003 SP2 上受支持。但是,当我尝试使用以下语法访问设置时:

然后null返回。但是,相同的应用程序在 Windows 7 和 Windows XP 上都能正常运行(即AppSettings["SettingName"]使用 时返回预期值configSource)。

configSource指向的文件肯定存在,因为我将整个应用程序目录从 Windows 7 复制到 Server 2003 进行测试。

有任何想法吗?

0 投票
1 回答
752 浏览

c# - 如何更改远程配置文件中的 configsource 值

我正在使用 ConfigurationManager.OpenMappedExeConfiguration 来读取和修改远程 Web 服务的 web.config 文件。这在大多数情况下效果很好。配置文件使用拆分出统一配置部分

如何将其更改为指向 Unity2.config?我试过了

这确实会更新 web.config 文件。但是,它也会导致 Unity2.config 被 Unity1.config 的内容覆盖,这不是我想要的。

另外,有没有办法刷新以这种方式打开的配置对象?

0 投票
1 回答
61988 浏览

asp.net - ASP.NET web.config:configSource 与文件属性

web.configASP.NET 应用程序的 -file 中,配置的某些部分(如appSettingsconnectionStrings)支持属性fileconfigSource

file使用-attribute 和-attribute有什么区别configSource?什么时候应该使用哪个属性,可以同时使用吗?

0 投票
1 回答
325 浏览

visual-studio-2010 - 对于使用 configSource 属性的 web.config 文件的每个部分,我们是否需要单独的配置文件?

我想将文件的某些部分保留web.config在 web.config 文件之外。所以我正在使用该configSource属性并引用其他一些文件。当我在文件中添加多个配置时web.config,VS 2010 显示红色波浪线表示Only one tag allowed at root level

是否需要为使用属性.config的 web.config 文件的每个配置部分设置单独的文件?configSource如果没有,如何摆脱上述VS2010投诉?

web.config 中的相关部分如下:

customAppConfiguration.config文件如下所示: