.NET Tip: Managing Development and Production Configuration Files Orlando FL

If you use one server to develop your applications and another to deploy them, you probably have to change your database connection settings each time you deploy your configuration files. Learn a quick fix for this problem.

Local Companies

Longview Solutions Inc
407-246-1030
135 N Magnolia Ave
Orlando, FL
Perceptive Technologies
(321) 206-5999
37 N. Orange Ave. Suite 810
Orlando, FL
Aspire Solution
407-894-5560
2909 Fairgreen St
Orlando, FL
Cam Commerce Solutions
407-774-8098
4449 Lipton CT
Orlando, FL
Riptide Software
407-384-8818
3452 Lake Lynda Dr
Orlando, FL
Tapestry Solutions
407-482-0270
3361 Rouse Rd
Orlando, FL
Acusoft
407-658-9888
11869 High Tech Ave
Orlando, FL
Progressive System Solutions Inc
407-523-7676
4019 Clarcona Ocoee RD
Orlando, FL
Group One Software
407-248-0998
7380 W Sand Lake Rd
Orlando, FL
Miller Software Systems Inc
407-354-5433
8504 Cedar Cove CT
Orlando, FL

provided by: 
Originally published at Internet.com


Most developers have one server they use to develop their applications and another server where they deploy the applications. The problem with this configuration is that you typically have to change your database connection settings, file locations, and so forth, each time you deploy your files. Inevitably, you'll add or remove settings from your configuration files and those settings won't be set up properly in the production environment.

A quick way to fix this problem is to use a prefix on your configuration settings and a function to determine which settings to use at runtime. Here's an example of a configuration file's appSettings section that is set up this way:

You then would create a function to wrap the ConfigurationManager class to determine which settings to retrieve, based on the Location setting: private string GetSetting(string setting) { string location = ConfigurationManager.AppSettings["Location"]; return ConfigurationManager.AppSettings[location + "." + setting]; }

Using this function is pretty easy: Response.Write(GetSetting("ConnectionString"));

When you deploy your code for this example, you can copy the entire configuration file to the server and simply change the Location from 'dev' to 'prod'. It's a fairly simple way to manage multiple configurations without a lot of work. You'd obviously want to beef up the GetSetting function to make sure that the setting wasn't empty, and so on, but the concept is something you might be able to use in your own applications.

About the Author

Eric Smith is the owner of Northstar Computer Systems, a Web-hosting company based in Indianapolis, Indiana. He is also a MCT and MCSD who has been developing with .NET since 2001. In addition, he has written or contributed to 12 books covering .NET, ASP, and Visual Basic. Send him your questions and feedback via e-mail at questions@techniquescentral.com.

Author: Eric Smith

Read article at Internet.com site

Featured Local Company

Longview Solutions Inc

407-246-1030
135 N Magnolia Ave
Orlando, FL

Related Local Events
PERFORMANCE RACING INDUSTRY SHOW 2009
Dates: 12/10/2009 - 12/12/2009
Location: Orange County Convention Center
Orlando, FL
View Details

American Rental Association Annual Convention and Rental Trade Show
Dates: 2/8/2010 - 2/11/2010
Location: Orange County Convention Center
Orlando, FL
View Details

Pittcon - Pittsburgh Conference and Exposition on Analytical Chemistry and Applied Spectroscopy
Dates: 3/1/2010 - 3/1/2010
Location: Orange County Convention Center
Orlando, FL
View Details

OOPSLA '09: ACM SIGPLAN Object Oriented Programming Systems and Applications Conference
Dates: 10/19/2009 - 10/23/2009
Location: Disney Coronado Springs Resort
Lake Buena Vista, FL
View Details

2009 3rd International Symposium on Empirical Software Engineering and Measurement (ESEM)
Dates: 10/15/2009 - 10/16/2009
Location: Hilton Walt Disney World Resort
Lake Buena Vista, FL
View Details