I have an ASP.NET 4.8 app that I am trying to integrate configuration builders into. I have installed the NuGet package Microsoft.Configuration.ConfigurationBuilders.Environment
and added the required sections to Web.config
(heavily truncated here).
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false"/>
</configSections>
<configBuilders>
<builders>
<add name="EnvironmentExpand" mode="Expand" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
</builders>
</configBuilders>
<system.serviceModel configBuilders="EnvironmentExpand">
....
</system.serviceModel>
</configuration>
When I run the application I get an HTTP 500 response from every action, with the message Unrecognized attribute 'configBuilders'
. Intellisense in Visual Studio also highlights configBuilders
and says The configBuilders attribute is not allowed
.
If I remove the configBuilders
attribute from system.serviceModel
the application runs correctly although of course none of the placeholders in that section are expanded.
If I remove the configBuilders
attribute from system.serviceModel
and add it to another section, for instance connectionStrings
, the application runs and the placeholders in the connectionStrings
section are replaced.
Clearly there's something different about the system.serviceModel
section but I don't understand what or how I can work around it so that I can replace placeholders in there.