Saving web.config files

I am interested to know how others support their web.config files for deployed applications. (in the absence of an automatic deployment mechanism - this is beyond the scope of this question)

Therefore, during development, some developers can use the web.config transformations, create / publish their projects (debug / release, test / live configurations), and then deploy all published artifacts to the web server and configure IIS. Some developers can create / publish their projects, deploy published artifacts to a web server, configure IIS, and then manually update web.configs for the specific environment (test / live, etc.) in which they are deployed.

Once the deployment is completed and the application is under development (both in a live and in a test environment), how are you going to support the web.config files over time, if you say that the database connection string or application settings key needs to be changed

Do you use web.config conversions, make changes to VS, republish the application, and then copy the entire application, or perhaps just the new web.config to the server?

Do you only manually make changes to web.config on the server?

You control the version of web.config of changes to the source control if lines such as connection strings, application keys, etc. have changed. (not structure)?

I am interested to know how others are approaching this.

We are currently making changes to the web.config file. When we introduce new features or bug fixes, we control these changes and any changes to the web.config file, such as new application keys, etc. If we need to deploy a new version of the application, we will create a backup copy of the current version on the production server, delete all file exception configuration files, then copy the new version without configuration files to the production server, saving the existing configuration. Then manually compare the existing configuration with the one that we have in the original control to account for changes in the circuit.

We shy away from revising this because we want the procedure to be reproducible and not vulnerable to human error. I am not sure if the solution is a 100% web.config conversion. Even if you use transformations, it still seems that human intervention is required in the deployment, because potentially the value in the production configuration file could be changed and not updated in the original control. How do others deal with this?

+8
source share
2 answers

We are using web.config conversions with VS 2010.

You can specify one main web.config file and use transformations to manage it for different environments (i.e. changing database connection strings). These transformations are automatically displayed when you deploy / publish your projects.

It also depends on what type of change you want to deploy. Although, as a rule, our deployment option is only to replace files that have been updated. Therefore, if all that we changed was a web.config.production transformation, then everything that was deployed.

And yes, we keep all web.config files and their conversions under source control, as they are part of the applications that rely on them.

There are also certain environments that we open for other teams / developers, but do not allow them to change the settings of web.config, so their deployment / publication settings skip the web.config file. Although, as a rule, we do not touch files directly on the server . We always update files locally so that changes can be tracked using source code management and deployed correctly.

+2
source share

Source control for us is a master store. All you need to change the HAS to enter it. Developers who try to work around this by changing configuration settings on PROD or STAGE sites are crashed. If something goes wrong, they are responsible for fixing any problems. Usually after the first all-consuming, they no longer do this. Then the version control configuration files are embedded in the web.config and settings.config files using xml / xslt

In my current project, I use web.config, which is the same in all environments, and using configSource to set specific server options

<appSettings configSource="App_Data\appsettings.config"/> 

Each environment has its own settings file.

  • appsettings.user1.dev.config
  • appsettings.user2.dev.config
  • appsettings.stage.config
  • appsettings.prod.config

In the release of the script package, we have enough of the necessary settings file and renamed it appsettings.config, then the entire release is loaded. The release can then be tagged in the source control.

+1
source share

All Articles