在Asp.Net中使用多个Appconfig文件时出现问题 [英] Problems using multiple Appconfig files in Asp.Net

查看:82
本文介绍了在Asp.Net中使用多个Appconfig文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有两个配置文件要在我的Asp.net项目中使用,另外在应用程序设置中有几个键直接添加到应用设置标记。如果我在我的webconfig中有1个带有键的文件引用它可以正常工作,但如果我有超过1个文件引用appsettings没有任何键工作并抛出错误。



Hi,

I have two Configuration Files to be used in My Asp.net Project, Also There are few keys in app settings which is directly added inside the app settings tag. If i have 1 File reference with keys in my webconfig it works properly, but if i have more than 1 file reference to appsettings none of the key works and throws error .

<appSettings file="config/first.config,config/second.config">
    <add key="Hi" value="Hellooooo"/>
</appSettings>



我看到一篇文章可以覆盖Appsettings的Desearialize方法,但我无法这样做..因为Asp.Net类是密封的



参考文章

在应用设置中添加多个文件 [ ^ ]



我有什么方法可以使用多个配置文件进行应用程序设置吗?



我看到下面的链接,似乎很划算,但有没有更简单的方法?

企业配置管理器 [ ^ ]

推荐答案

亲爱的朋友,



您可以控制两个app配置文件或两个web配置文件将它们分别放在你想要使用App Key的相应文件夹中。



我之前也遇到过这个问题并试过这个解决方案。它也可以在你的情况下工作。



请告诉我它是否有效,如果有效,也不要忘记将其标记为你的答案。 />


问候



Varun Sareen
Dear Friend,

You can control the two app config files or two web config files working by separately putting them in the respective folders where you want to use the App Key accordingly.

I have also earlier faced this problem and tried this solution. It also might work in your case.

Please let me know if it works and also don''t forget to mark this as your answer if it works.

Regards

Varun Sareen


这篇关于在Asp.Net中使用多个Appconfig文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆