首页 > 解决方案 > Azure App Service 应用程序设置未覆盖 .NET Core 3.1 应用程序的 application.json 数组设置

问题描述

我们有一个部署到 Microsoft Azure 的 .NET Core 3.1 应用程序。在应用程序的 application.json 文件中,我们有以下内容:

{
"Settings": {
    "ServicesURIs": [
      {
        "Name": "Features",
        "URL": "https://abc.azurewebsites.net",
        "Port": "443",
        "ScopeUri": "api://xxxxxx",
        "enabled": "true"
      },
      {
        "Name": "Questions",
        "URL": "https://def.azurewebsites.net",
        "Port": "443",
        "ScopeUri": "api://XXXXX",
        "enabled": "true"
      }
    ]
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "pwa": {
    "cacheId": "v1.3",
    "strategy": "networkFirst",
    "registerWebmanifest": true,
    "routesToPreCache": "/"
  }
} 

我希望覆盖 Azure 中应用程序服务配置中应用程序设置部分的 URL 属性。

我目前在每个文档和许多在线博客的配置刀片中指定以下应用程序设置:

Name= Settings:ServicesURIs:0:URL
Value= https://Somevalidurl.azurewebsites.net

但是我发现应用程序没有使用门户配置中的值,并且总是尝试使用 .json 文件中的值。

我尝试将名称指定为

Settings__ServicesURIs__0__URL

(其中“:”替换为双下划线)

在 Azure 中注册设置后,我已重新启动应用程序服务。

我在 Incognito 中使用 Chrome 对此进行了测试,以确保缓存不起作用。

标签: azure.net-coreconfigurationappsettings

解决方案


推荐阅读