machine.config

How do I have one location for connection strings machine wide?

我的未来我决定 提交于 2019-12-01 11:07:45
问题 I have found that in the Machine.config you can add your connection strings so that you don't need your connection strings in each running apps config file. The down side to this is that you have number of framework versions * 2 machine.config file. So for version 4.* you have 2 alone. This took my research on to find that you can externalize the connection string using the configSource attribute in the connectionString element of the machine.config <connectionStrings configSource="Config

machine.config appSettings are null

ⅰ亾dé卋堺 提交于 2019-11-30 19:10:41
In my machine.config file I have the following <configuration> .... <appSettings> <add key="key" value="value"/> </appSettings> </configuration> I am trying to retrieve it on an asp page by using ConfigurationManager.AppSettings["key"]; and it returns null every time. You probably put it in the wrong machine.config. Remember that there is the same machine.config for .NET 2.0 and 3.5 as they both target CLR 2.0 ( c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\ ) and a separate machine.config for .NET 4.0 ( c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\ ). Also remember that if you