Configo.Client.NetFramework
0.0.2
dotnet add package Configo.Client.NetFramework --version 0.0.2
NuGet\Install-Package Configo.Client.NetFramework -Version 0.0.2
<PackageReference Include="Configo.Client.NetFramework" Version="0.0.2" />
<PackageVersion Include="Configo.Client.NetFramework" Version="0.0.2" />
<PackageReference Include="Configo.Client.NetFramework" />
paket add Configo.Client.NetFramework --version 0.0.2
#r "nuget: Configo.Client.NetFramework, 0.0.2"
#:package Configo.Client.NetFramework@0.0.2
#addin nuget:?package=Configo.Client.NetFramework&version=0.0.2
#tool nuget:?package=Configo.Client.NetFramework&version=0.0.2
Configo.Client.NetFramework
A .NET Framework 4.8 client library for integrating with Configo configuration management.
Overview
This library provides a simple way for .NET Framework applications (Web applications, Windows Services, Console apps) to retrieve configuration from a Configo server and automatically populate ConfigurationManager.AppSettings and ConfigurationManager.ConnectionStrings using the standard Microsoft.Configuration.ConfigurationBuilders pattern.
Features
- ✅ Built on
Microsoft.Configuration.ConfigurationBuilders- the standard way to extend configuration in .NET Framework - ✅ Automatic population of
ConfigurationManager.AppSettings - ✅ Automatic population of
ConfigurationManager.ConnectionStrings - ✅ JSON-based caching for offline support (when Configo server is unavailable)
- ✅ Declarative configuration via Web.config/App.config
- ✅ Compatible with .NET Framework 4.8
Installation
Install-Package Configo.Client.NetFramework
Or via .NET CLI:
dotnet add package Configo.Client.NetFramework
Usage
Basic Setup (Web.config or App.config)
Add the Configo configuration builder to your configBuilders section and apply it to appSettings and connectionStrings:
<?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="configoAppSettings"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://your-configo-server.com"
apiKey="your-api-key-here"
cacheFileName="appsettings.configo.json" />
<add name="configoConnectionStrings"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://your-configo-server.com"
apiKey="your-api-key-here"
cacheFileName="appsettings.configo.json" />
</builders>
</configBuilders>
<appSettings configBuilders="configoAppSettings">
</appSettings>
<connectionStrings configBuilders="configoConnectionStrings">
</connectionStrings>
</configuration>
That's it! No code changes needed. The configuration builder will automatically:
- Fetch configuration from your Configo server at application startup
- Cache it to
appsettings.configo.jsonfor offline scenarios - Populate
ConfigurationManager.AppSettingsandConfigurationManager.ConnectionStrings
Configuration Builder Attributes
| Attribute | Required | Default | Description |
|---|---|---|---|
url |
Yes | - | The Configo server URL |
apiKey |
Yes | - | The API key for authentication |
cacheFileName |
No | appsettings.configo.json |
Cache file for offline support |
Advanced Configuration
Using Environment Variables for API Key
For security, you can use environment variables or other config sources for sensitive values:
<configBuilders>
<builders>
<add name="Environment"
type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
<add name="Configo"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://your-configo-server.com"
apiKey="${CONFIGO_API_KEY}"
section="AppSettings"
cacheFileName="appsettings.configo.json" />
</builders>
</configBuilders>
<appSettings configBuilders="Environment,Configo">
</appSettings>
Custom Cache Location
<add name="Configo"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://your-configo-server.com"
apiKey="your-api-key-here"
section="AppSettings"
cacheFileName="C:\ProgramData\MyApp\configo-cache.json" />
Disable Caching
Set cacheFileName to an empty string to disable caching:
<add name="Configo"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://your-configo-server.com"
apiKey="your-api-key-here"
section="AppSettings"
cacheFileName="" />
Accessing Configuration in Code
Once configured, access settings normally through ConfigurationManager:
using System.Configuration;
// AppSettings
var mySetting = ConfigurationManager.AppSettings["MySetting"];
var apiEndpoint = ConfigurationManager.AppSettings["ApiEndpoint"];
// ConnectionStrings
var connString = ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString;
Configuration Format
The Configo server should return JSON in the following format:
{
"AppSettings": {
"Setting1": "Value1",
"Setting2": "Value2",
"ApiEndpoint": "https://api.example.com"
},
"ConnectionStrings": {
"DefaultConnection": "Server=myserver;Database=mydb;Trusted_Connection=true;",
"CacheConnection": "Server=cache;Database=redis;..."
}
}
Only the AppSettings and ConnectionStrings sections are processed. Other sections in the JSON will be ignored.
Caching and Offline Support
By default, configuration is cached in appsettings.configo.json in the application's working directory. This cache file is used when:
- The Configo server is unreachable
- Network connectivity is lost
- The Configo server is temporarily down
When using the cache fallback, a warning is written to the trace output.
Error Handling
The configuration builder will throw ConfigurationErrorsException when:
- Required attributes (url, apiKey) are missing
- The URL is not a valid absolute URI
- The Configo server is unreachable and no cache file exists
- The cache file exists but cannot be parsed
These errors occur during application startup, which is the standard behavior for configuration errors in .NET Framework.
Integration with Other ConfigBuilders
Configo works seamlessly with other configuration builders. You can chain multiple builders:
<configBuilders>
<builders>
<add name="Environment"
type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
<add name="Configo"
type="Configo.Client.NetFramework.ConfigoConfigurationBuilder, Configo.Client.NetFramework"
url="https://configo.example.com"
section="AppSettings"
apiKey="${CONFIGO_API_KEY}" />
<add name="UserSecrets"
type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.UserSecrets" />
</builders>
</configBuilders>
<appSettings configBuilders="Environment,Configo,UserSecrets">
</appSettings>
Limitations
This is a simplified implementation for .NET Framework with the following limitations compared to the .NET Core version:
- ✋ No auto-refresh support (configuration is loaded once at startup)
- ✋ Only supports
AppSettingsandConnectionStringssections - ✋ No nested/hierarchical configuration support beyond these sections
- ✋ No strongly-typed configuration binding (use .NET Core's
IOptions<T>for that)
For more advanced scenarios, consider migrating to .NET Core/5+ and using Configo.Client.
Comparison with Configo.Client (.NET Core)
| Feature | Configo.Client (.NET Core) | Configo.Client.NetFramework |
|---|---|---|
| Target Framework | .NET 6.0+ | .NET Framework 4.8 |
| Configuration System | IConfiguration | ConfigurationManager |
| Configuration Pattern | IConfigurationBuilder | ConfigurationBuilders |
| Setup | Code-based | Declarative (Web.config/App.config) |
| Configuration Format | Full JSON hierarchy | AppSettings + ConnectionStrings only |
| Auto-refresh | ✅ Yes | ❌ No |
| Strongly-typed binding | ✅ Yes (IOptions<T>) | ❌ No |
| Caching | ✅ Yes | ✅ Yes |
| Integration | Microsoft.Extensions.* | System.Configuration |
Troubleshooting
Configuration builder not loading
- Verify the
configSectionselement is at the top of your config file - Check that the
typeattribute exactly matches the assembly-qualified name - Ensure
Configo.Client.NetFramework.dllis in your application's bin directory - Check the Application Event Log for any startup errors
Configo server connection errors
- Verify the URL and API key are correct
- Check network connectivity to the Configo server
- Look for a cached configuration file (
appsettings.configo.json) - Check trace output for warnings about cache fallback
Configuration values not appearing
- Verify the section uses
configBuilders="Configo" - Check that the Configo server is returning data in the correct format
- Inspect the cache file to verify the data structure
- Enable trace output to see what the builder is doing
License
See the main Configo repository for license information.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Microsoft.Configuration.ConfigurationBuilders.Base (>= 3.0.0)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.