azure - 在 azure webapp 上应用 appsettings.json

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

我想在我的 Azure Web 应用程序上的应用程序设置下设置一个键值对。

我尝试了许多不同的方法来在我的 appsettings.json 上设置它,但是没有一个有效。

这是我尝试过的:

测试1

{
  "APPSETTING_WEBSITE_TIME_ZONE": "E. South America Standard Time",
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

还有

{
  "AppSettings:WEBSITE_TIME_ZONE": "E. South America Standard Time",
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

另一个测试

{
  "AppSettings": {
    "WEBSITE_TIME_ZONE": "E. South America Standard Time"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

最佳答案

通常,您可以在 appsettings.json 中设置应用设置。请参阅doc了解详情。

此处的问题是您尝试设置 WEBSITE_TIME_ZONE,这是 Azure Web Apps 识别的特殊设置。为了使其有效,必须将其设置为 Azure 应用程序设置。对于各种其他特殊 WEBSITE_ 设置也是如此(例如,参见 s list here )。

关于azure - 在 azure webapp 上应用 appsettings.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42695051/

相关文章:

http - 我的 Azure 网站在(监视器)门户中有一个奇怪的 "HTTP success"模式

Azure Web应用程序安全组访问

azure - 在 Azure Application Insights 中查看具有零 View 的 Azure Web 应用页面

azure - 在 SAML 中使用用户主体名称 (UPN) a 的 NameId 的推荐 NameId 格式

angularjs - 网络核心。有 Angular 的。静态页面和html5模式

c# - .NET Core - 从 Azure Ubuntu VM 下载或读取 Json 文件内容

c# - 尝试使用 Google.Apis.Gmail 从 ASP.NET Core Web API 应用程序从 google 工作区发送电子邮件时出错

c# - 通过调用 'IServiceCollection.AddHealthChecks' 添加所有需要的服务

azure - Azure Log Analytics 在哪里存储数据?

azure - 如何区分cosmosdb触发器中的delete update create到azure函数