【问题标题】:How to create Azure Feature Flag for the App Configuration through c# code?如何通过 c# 代码为应用配置创建 Azure 功能标志?
【发布时间】:2022-01-06 23:37:53
【问题描述】:

我正在使用 .net core 3 在 App 配置中创建配置设置。我能够在配置资源管理器中使用以下代码 sn-p 和下面链接中的一些附加配置创建一个键值对

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

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

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

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

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我发现你可以使用Azure App Configuration client library for .NET添加.appconfig.featureflag/new

      但是您不能在门户的配置浏览器中创建.appconfig.featureflag/new。您可以检查如下图像。你也可以在你身边试试。

      所以我认为这是库的问题,没有限制。

      【讨论】:

        【解决方案3】:

        我能够为功能标志管理和使用实施整个端到端方案。你可以找到帖子here

        【讨论】:

          猜你喜欢
          • 2020-10-17
          • 2020-11-12
          • 2021-12-08
          • 2020-07-25
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-05-15
          • 2021-11-08
          相关资源
          最近更新 更多