asp.net - 覆盖 Azure 应用程序设置中的 appsettings.json 值

标签 asp.net azure azure-web-app-service

我有一组应用程序设置值,如下所示。我们使用 Windows 应用服务

"MainDomains": {
"Domains": [
  {
    "Id": "123456",        
    "Domain": "Technical",       
    "PolicyUrl": "https://www.mytechdomain.net",
    "LearningPoint": "https://www.mytechdomain.net",
    "Hostnames": [
      "https://localhost:4567",
      "http://localhost:34565",          
      "https://mytechdomain.latestlearn.com"
    ],
    "UsePreviewContent": true,
    "IsDefault": true,
    "OriginEmail": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5b32353d341b2f3e38333f34363a323575353e2f" rel="noreferrer noopener nofollow">[email protected]</a>",
    "mytechname": "Techdomain"
  }
]

}

我如何在配置下的 Azure 应用程序设置中正确设置这些值。我已经尝试过像property1:property2:0 --> xxxvalue。但这似乎不起作用。我猜测可能是我在另一个数组中有一个数组。其中第一个数组是 MainDomains,MainDomains 数组中的另一个数组是域。

最佳答案

您应该在 appsettings.json 中使用相同的分隔格式设置应用设置名称。但就像 Gaurav Mantri 所说,在门户上使用双下划线 __ 而不是 :

引用Configuration keys and values的描述:

In environment variables, a colon separator may not work on all platforms. A double underscore, __, is supported by all platforms and is automatically converted into a colon :.

您还可以查看 official document about how to set App Settings .

关于asp.net - 覆盖 Azure 应用程序设置中的 appsettings.json 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66901254/

相关文章:

azure - 如何在另一个租户(未创建该应用程序的租户)中注册 Azure AD Multi-Tenancy 应用程序

c# - 如果 Azure 应用服务每 1 分钟发出一次 HTTP 请求,它是否会被卸载?

node.js - Express 中的响应流在 Azure 应用服务中不起作用

jquery - 一个网页可以处理两个版本的 jQuery 吗?

C# 单元测试 - 无法从 IHttpActionResult 响应中提取内容

javascript - 将 JSON 字符串发布到 ASP.NET MVC 3 操作导致空参数

azure - Azure B2C 和 ADFS 作为身份提供商的声明

c# - Service Stack Redis 连接的线程安全

azure - Azure Web应用程序和Web作业的不同连接字符串

Azure 应用程序状态页面