c# - 如何通过c#代码为应用程序配置创建Azure功能标志?

标签 c# azure asp.net-core azure-app-configuration azure-feature-manager

我正在使用 .net core 3 在应用程序配置中创建配置设置。我能够使用以下代码片段和下面链接中的一些附加配置在配置资源管理器中创建键值

var client = new ConfigurationClient(_configuration.GetConnectionString("AppConnectionString"));
var settingToCreate = new ConfigurationSetting(model.Key, model.Value);
client.SetConfigurationSetting(settingToCreate);

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md#create-a-configuration-setting

我目前正在使用相同的方法在应用程序配置的功能管理器 Pane 中创建功能标志,但为功能标志提供内容类型,如下所示。

var client = new ConfigurationClient(_configuration.GetConnectionString("AppConnectionString"));
var settingToCreate = new ConfigurationSetting(model.Key, model.Value);
settingToCreate.ContentType = "application/vnd.microsoft.appconfig.ff+json;charset=utf-8";
client.SetConfigurationSetting(settingToCreate);

问题是它创建了一个功能标志但没有名称,显示如下错误消息 configuration explorer

feature manager

请提出任何可能的解决方案。提前致谢!

最佳答案

请参阅this sample用于使用 .NET SDK for App Configuration 管理功能标志。

关于c# - 如何通过c#代码为应用程序配置创建Azure功能标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70166248/

相关文章:

c# - 另一个sql查询语句

c# - 无法在 Visual Studio (Mac) 上使用 .NET Core 3.1 创建 Web 应用

c# - 在 Azure DocumentDB 中使用 MongoDB 和 .NET 驱动程序会引发 MongoCommandException

c# - 缓冲流 - ASP.NET Core 3.0 中不允许同步操作

c# - 当我在 Unity 中输入立方体时尝试加载新场景

c# - 检查两个区域是否接触

c# - Android 和 REST Web 服务响应帮助

azure - 使用 ADF REST 连接器读取和转换 FHIR 数据

python - 假定角色 python 错误无权执行:sts:AssumeRole 对资源:arn:aws:iam::xxxxxxxxx

azure - 构建管道成功后,适用于Docker镜像的Azure发布管道