0

I have an application that gets deployed to a load balanced environment. This application is an asp.net mvc4 application.

I have settings (appsettings & httpheaders) in the web.config for each server. Rather than managing them during deployment, is there a way to set them on the machine and available in the application?

amateur
  • 43,371
  • 65
  • 192
  • 320

1 Answers1

1

You can set your specific settings in the machine.config file on each server. You'll then be able to access those settings, as you would an app setting in the web.config:

string setting = ConfigurationManager.AppSettings["machine.somekey"];

See this post for the location of the machine.config file.

Community
  • 1
  • 1
Alex
  • 34,899
  • 5
  • 77
  • 90
  • Cool - where is the machine config file located? – amateur Mar 18 '13 at 22:42
  • Is the web.config or machine.config file I should update in that folder? – amateur Mar 18 '13 at 22:53
  • The machine.config file is located in your .NET framework installation directory. In my case (Windows 8), the 32-bit version of the .NET framework 4 machine.config file is located in: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config . The 64-bit version is located in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config. – Erik Schierboom Mar 19 '13 at 13:04