Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple environments in ASP.Net MVC 2

I am learning ASP.Net MVC 2, coming from a PHP and some Rails background, and one of the only things that seems off to me is the way you manage config settings like connection strings, or endpoints for external services.

With the PHP framework my previous company used there was a standard format and convention for config files. My company was able to leverage this to make it so that a different config file would be loaded based on an environmental variable (which was set in the Apache config). This made it very simple and automatic to change any config setting based on the environment. As far as I know, Rails has some version of this functionality built-in.

I am familiar with the app.config and web.config files of the .Net world, but is there a way to have these change based on the environment, preferably automatically, and with various levels of granularity? The whole config system seems very anemic compared to what I'm used to.

I could probably hack something together to accomplish this, but I wanted to see what approach people are taking in practice, or if there's some standard tool people are using.

like image 584
davidtbernal Avatar asked Nov 24 '10 21:11

davidtbernal


1 Answers

There is web.config transformations.

I am likely wrong, but I seem to recall that they wouldn't get applied if one simply started the application with the "Start Debugging (F5)" button inside Visual Studio, making the feature seem impractical for a lot of uses.

like image 52
quentin-starin Avatar answered Oct 10 '22 07:10

quentin-starin