I am using file based User Secrets within my .Net Framework WebAPI and all is working fine with the AppSettings
section of the web.config
as per below
<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="Secrets" userSecretsFile="MySecretsFile.xml" type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.UserSecrets, Version=1.0.0.0, Culture=neutral" />
</builders>
</configBuilders>
<appSettings configBuilders="Secrets">
<add key="mysetting1" value="(default)" />
<add key="mysetting2" value="(default)" />
</appSettings>
</configuration>
However, I now need to add same for connectionStrings
for EF connections and the following entries are in the web.config
below
<connectionStrings configBuilders="Secrets">
<add name="Entities" connectionString="A" providerName="System.Data.EntityClient" />
</connectionStrings>
When I run the app (in Visual Studio) I get the following error showing that the ConfigurationBuilders
is having issues finding something.... but I don'k know what ... thing is, all the appSettings
and configurationStrings
are loading as expected.
If I remove the configBuilders="Secrets"
, then the error does not show.
So what am I missing, how can I find out what is it trying to load, but cannot find.