views:

31

answers:

2

Hello

I have web application and and DB connection settings are stored in web.config The problem is that this application is deployed to multiple servers and connection string may vary. So I would like to have the same web.config on all server and actual configuration settings be externalized, for example to XXX.properties - this is pretty similar to java world - config file has place holders and values are read from other files

Again: all server has the same web.config files and unique XXX.properties

How can i configure this?

thak you

+1  A: 

For connection strings you can use the configSource attribute:

<connectionStrings configSource="connectionStrings.config"></connectionStrings>

At our applications we manage the connection string configuration file varyingly. For some projects we simply store the config file somewhere outside the main project root, so we can safely publish to it. For others with proper CI setup we use a custom build task to copy the correct configuration file depending on the build type.

If you're on Visual Studio 2010, you could also look into Web Config Tranformations.

fencliff
+1  A: 

Just put the location of your external config file in the web.config.

Then in your code, you can read and parse your external file to get the settings for the app.

Ed B