Azure App Service部署-无法覆盖appsettings.json

问题描述 投票:1回答:1

我在管道中有一个Azure App Service Deploy任务,用于将Web Api Core应用程序部署到Azure App Service。该任务具有以下yaml-

- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    azureSubscription: 'myserviceconnection'
    appType: 'webAppLinux'
    WebAppName: 'mytestwebapp'
    packageForLinux: '$(Build.ArtifactStagingDirectory)/**/*.zip'
    AppSettings: 'TestWebApp/TestWebApp/appsettings.json'

我一直关注this document,了解如何更新.json文件中的设置。据我了解,我不得不在管道中创建一个变量,该变量与我需要更新的密钥相匹配。假设我的appsettings.json-

中具有以下Json结构
{
  "AllowedHosts": "*",
  "ServiceConfiguration": {
    "Key1": "value1",
    "Key2": {
      "Key3": "value3",
      "Key4": "value4"
    }
  }
}

假设我必须将key1更新为somenewvalue1,并且将key2.key3更新为someothervalue3,依此类推。因此,我通过点击管道上的“变量”按钮创建了新变量,并添加了Key1key2.key3作为具有适当值的变量(注意,该值是一个常量字符串,但是我希望它是一个动态值,将由管道中的另一个任务提供)。另外,我提供了appsetting文件的路径,如下图所示-

enter image description here

但是,当我运行管道时,出现以下错误-

enter image description here

Error: BadRequest - Parameter name cannot be empty. (CODE: 400)

我遇到了这个SO question,还在azure门户上创建了应用程序设置,但这也没有用

我在这里做错什么。

作为副问题,如第一幅图所示,文件转换和变量替换选项应用程序和配置设置有什么区别,何时使用。

编辑

根据评论,我能够解决此问题,因此不再有错误,并且能够在azure门户中验证更新的设置。

但是,当我在浏览目录下的站点wwwroot文件夹中看到来自Kudu的appsetting.json时,我看不到它已更新。这些值为何不同,如果存在差异,则实际考虑哪个值。

谢谢

我在管道中有一个Azure应用服务部署任务,以将Web Api Core应用部署到Azure应用服务。该任务具有以下yaml--任务:AzureRmWebAppDeployment @ 4输入:...

azure azure-devops azure-web-app-service appsettings
1个回答
0
投票

所以似乎有人期望JSON包含设置,而不是文件路径。

© www.soinside.com 2019 - 2024. All rights reserved.