We have a web application running on-premise at a variety of customers. The web.config contains lots of
- stuff which is "part of our application" (such as most of the
<system.web>
and<system.webServer>
blocks) and - stuff which needs to be customized (connection strings, app settings, and various custom tags).
During updates, part 1 should be replaced and part 2 should be left as it is. Ideally, I'd have a web.app.config
and a web.custom.config
, so I can replace only the first one. Of course, IIS would need to magically "merge" those at run time, which it does not do.
I found the following approaches:
Put the custom stuff in external files, i.e.
<appSettings configSource="appSettings.config"/>
.I cannot use that, because it can only be used for complete sections. But, for example, the
aspnet:MaxHttpCollectionKeys
setting is a value that should be controlled by the application, whereas other app settings values should be customizable.Parameterization or Web.Config Transformation.
I cannot use that, because our customers have various versions of our application installed. Thus, I need to replace the application-specific parts of web.config rather than transforming individual tags. In addition, I'd like to avoid adding msdeploy to our deployment process (xcopy plus some scripts to create the IIS apps and configure them work great at the moment). Oh, and I'd still have one big web.config with application-specific and customer-specific stuff meshed together.
Is there some elegant solution that I've missed?