I've been trying to get an ASP.NET API setup, but I keep getting this error on the IIS Server when trying to check the Connection Strings. The project is a straight up new ASP.NET API Project with only 2 added variables to the registration table.
My Connection String (web.config):
<configBuilders>
<builders>
<add name="Secrets" userSecretsId="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.UserSecrets, Version=2.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx" />
</builders>
</configBuilders>
<connectionStrings configBuilders="Secrets">
<add name="DefaultConnection" connectionString="Data Source=SERVER;Initial Catalog=myAPIApp;Persist Security Info=True;User ID=xxxxxxx;Password=xxxxxxx" />
</connectionStrings>
After installed the below
Nuget
package,https://www.nuget.org/packages/Microsoft.Configuration.ConfigurationBuilders.Environment/
We should register
configbuilder
firstly before using a custom configuration builder.Please refer to my configuration of obtaining the
ServiceID
fromSystem Environment Variables
preferentially.ServiceID/ServiceKey
will be obtained the value from System Environment Variables if it sets.Feel free to let me know if the problem still exists.