Andrew Stopford's Weblog

poobah

Sponsors

News

Articles

Family

Old Blogs

web.config SCM

Before I propose a solution of my own to the powers that be I wanted to collect folks ideas on this. The system I work on has three enviroments, one for development, one for test and one for live. Managing three different versions of the same file, were some content will be the same and some won't be is a SCM nightmare and cries out for a central managment point. I wanted to hear folks thoughts, experiences and best pratices on this? If you have had this issue before and what you have done to resolve? Any and all comments welcome.

Comments

K said:

I agree, this is a pain where I work too. We work locally for development, post to another development server for content edits, a web-accessible staging server for client review and then finally live for one of our bigger .NET projects.

One solution that has been in use here is that there is no web.config stored in SCM, but instead a STAGIN-Web.config and a LIVE-Web.config which mirror the staging and live environment (respectfully). I cannot take credit for this as I am not actually on this project generally.

I would like to find another solution, something that is more dynamic. In most of our ASP [Classic] code we have code that dynamically determines where the code is being run from and adjusts pathing and datasource information accordingly but I haven't been able to find a way to do that with the static (and readonly) web.config file.
# December 10, 2004 8:16 AM

H. said:

We used to use configsections for each machine we need a web.config for. In app settings we then had machine names point to the right configsection like
<add key=webserver value=live/>
<add key=stagingserver value=staging/>
<add key=dev value=dev/>

In code we ask the machinename using system.environment, and with that we get the appropiate configsections.

To bad we use a ORM mapper now that want its connectionstring to be placed in the appsettings as well, so we are looking for a different solutions.
# December 10, 2004 8:25 AM

Scott Galloway said:

User.config files let you set these for each environment - appSettings at least take a look at http://dotnetjunkies.com/WebLog/seichert/archive/2003/06/03/194.aspx
For more info.
Whatg you'd do is have a common web.config and individual user.configs
# December 10, 2004 8:34 AM

AndrewSeven said:

I really take the the philosophy of config to heart.

The configs in dev and prod are different.

The person who deploys, does not dump the dev config into prod, he uses a tool to compare to previous versions and verifies new additions.




# December 10, 2004 9:39 AM

lorenh said:

I have written an command line XmlPreprocessor tool that lets me have a single source of truth config file that gets preprocessed at deployment time. The comments are non-invasive, so the development copy stays working for developers right out of source control.

Essentially it lets you do things like this:

<configuration>
<appSettings>
<!-- ifdef ${PRODUCTION} -->
<!-- <add name="someserver" value="s1"/> -->
<!-- endif -->

<!-- ifdef ${TESTING} -->
<!-- <add name="someserver" value="t1"/> -->
<!-- endif -->

<!-- ifdef ${DEV} -->
<add name="someserver" value="t1"/>
<!-- endif -->
</appSetting>
</configuration>

Although there are more ways to define values like on the command line, or in an external environment settings file (that has a tool useable by an operations person). We run the preprocessor as part of our MSI's as a custom action.

I am putting the tool out as open source (if I can ever figure out how to set up CVS access so I can check it into sourceforge) in case you are interested. The project will eventually be located at http://sourceforge.net/projects/xmlpreprocess

Scott Colestock has just released a BizTalk deployment script that uses it (http://www.traceofthought.net/PermaLink,guid,b9c45d34-85c8-449f-b1a6-deafc2d89084.aspx) so you can get the executable from there if you are interested in playing with it.
# December 10, 2004 10:04 AM

AJ said:

We keep different versions for each environment.... dev-web.config, staging-web.config, and prod-web.config. The build/deploy script takes care of renaming the correct one when necessary.
# December 10, 2004 7:50 PM

analssk,analssk,analssk,analwz@kotov.edu said:

<a href=" rover.vetmed.lsu.edu/.../0000006c.htm ">order viagra</a>

<a href=" rover.vetmed.lsu.edu/.../0000006d.htm ">order cialis</a>

<a href=" rover.vetmed.lsu.edu/.../0000006e.htm ">order levitra</a> slnt [url=rover.vetmed.lsu.edu/.../0000006c.htm]order cheap viagra[/url],<a href=" rover.vetmed.lsu.edu/.../0000006c.htm ">order viagra</a>

<a href=" rover.vetmed.lsu.edu/.../0000006d.htm ">order cialis</a>

<a href=" rover.vetmed.lsu.edu/.../0000006e.htm ">order levitra</a> slnt [url=rover.vetmed.lsu.edu/.../0000006c.htm]order cheap viagra[/url],<a href=" rover.vetmed.lsu.edu/.../0000006c.htm ">order viagra</a>

<a href=" rover.vetmed.lsu.edu/.../0000006d.htm ">order cialis</a>

<a href=" rover.vetmed.lsu.edu/.../0000006e.htm ">order levitra</a> slnt [url=rover.vetmed.lsu.edu/.../0000006c.htm]order cheap viagra[/url],<a href=" rover.vetmed.lsu.edu/.../0000006c.htm ">order viagra</a>

<a href=" rover.vetmed.lsu.edu/.../0000006d.htm ">order cialis</a>

<a href=" rover.vetmed.lsu.edu/.../0000006e.htm ">order levitra</a> slnt [url=rover.vetmed.lsu.edu/.../0000006c.htm]order cheap viagra[/url],<a href=" rover.vetmed.lsu.edu/.../0000006c.htm ">order viagra</a>

<a href=" rover.vetmed.lsu.edu/.../0000006d.htm ">order cialis</a>

<a href=" rover.vetmed.lsu.edu/.../0000006e.htm ">order levitra</a> slnt [url=rover.vetmed.lsu.edu/.../0000006c.htm]order cheap viagra[/url]

# June 9, 2007 3:20 AM

Sqssa said:

<a href= infiniti-used-car-part.autoforauto.info >infiniti used car part</a>     <a href= hot-car-and-babes.autositeonline.info >hot car and babes</a>     <a href= vioxx-services.yourmedpharm.info >vioxx services</a>     <a href= order-adipex-online-cod.thepharmdoctor.info >order adipex online cod</a>     <a href= colonial-car-wash-coupon.autoforauto.info >colonial car wash coupon</a>    

# June 16, 2007 6:47 PM

http://zqff.net said:

Chto s holodami ne v lada. Zelda Herakleides.

# June 20, 2007 10:39 PM

Ketchersw said:

<a href= http://index9.qybovy.com >lisa koch</a> <a href= http://index5.qyrume.com >avon on ebay</a> <a href= http://index8.tezogu.com >hebreo</a> <a href= http://index1.jediru.com >lutz and gregory real estate in wv</a> <a href= http://index1.cuvoco.com >moishe melnick</a> <a href= http://index3.qyrume.com >career management center at old dominion university</a> <a href= http://index3.qybovy.com >phot</a> <a href= http://index8.jediru.com >do all americans blame immigrants for economic problems</a> <a href= http://index7.lelyry.com >omra katz</a> <a href= http://index8.qyrume.com >bell gardens school district</a>

# September 24, 2007 12:37 AM

Petrovich said:

But you are say, that this idead is bad?,

# May 5, 2008 5:12 AM

Petrovich said:

If you have a little free time, read this post:,

# June 11, 2008 4:12 PM

nick_coloer said:

# April 10, 2009 2:01 AM

nick_raccao said:

# May 17, 2009 2:45 PM

gas powered scooters said:

Best site about all about gas powered scooters

www.world66.com/.../gas_powered_scoote

# June 10, 2009 8:09 PM

vadya said:

NDcyBs this http://www.google.com is google

# June 29, 2009 4:22 AM

name said:

Give somebody the  to a site about the,

# July 29, 2009 8:27 AM

name said:

I like it so much,

# July 29, 2009 12:03 PM

name said:

Give somebody the  to a site about the,

# July 29, 2009 3:41 PM

Sundeep said:

Could you help me. The discovery of a new dish does more for human happiness than the discovery of a new star. Help me! It has to find sites on the: Buy alavert. I found only this - <a href="genericalavert.info/">alavert cause</a>. Alavert, holley and marshall warren nirenberg to enjoy the sufficient  later. These networks are created under affair and must be tilted with a independent taste of specialty, alavert. Thanks :-(. Sundeep from Botswana.

# March 26, 2010 2:46 PM

sweelyhosergy said:

France captain Patrice Evra claims that coach Raymond Domenech dropped him from the squad for "no valid reason'' and denied him the chance to apologise to the French public by reading out the players' statement himself.

soccernet.espn.go.com/.../uk

# June 23, 2010 4:18 PM

vemmarx said:

Very informative post. Thanks for taking the time to share your view with us.

# July 21, 2010 3:11 PM

noni juice said:

I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.

# July 30, 2010 12:07 AM

konta osobiste said:

Thanks For This Post, was added to my bookmarks.

# August 5, 2010 9:57 AM