You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署Azure Function时LinuxFxVersion参数值无效如何解决

问题原因

该报错由配置和实际运行环境、部署目标不匹配直接导致:

  • 你要部署的是.NET Framework应用,.NET Framework仅支持Windows托管环境,linuxFxVersion是Linux版应用服务/函数应用才支持的运行时配置参数,Windows环境下配置该参数会直接触发无效值错误。
  • 现有配置中reserved: false明确标识关联的应用服务计划为Windows类型,和你配置的linuxFxVersion: 'DOTNETCORE|6.0'存在环境冲突,且DOTNETCORE|6.0对应的是.NET 6(Core系)运行时,并非.NET Framework的运行时标识。
修正方法

首先确认你关联的App Service Plan为Windows类型(.NET Framework不支持Linux托管),再按如下规则调整Bicep配置:

  1. 删除siteConfig下的linuxFxVersion配置项
  2. 在siteConfig下添加netFrameworkVersion配置指定.NET Framework版本,.NET Framework适配的Azure Function v1版本最高支持v4.8
  3. 补充必要的应用配置,指定Azure Function运行时版本为~1(只有v1版本支持.NET Framework),配置工作运行时为dotnet,以及关联存储的连接字符串。

修正后的资源配置参考:

resource resourceName_resource 'Microsoft.Web/sites@2021-02-01' = {
  name: resourceName
  location: resourceLocation
  identity: {
    type: 'SystemAssigned'
  }
  tags: {
    'hidden-related:${appServicePlan_ResourceId}': 'empty'
  }
  kind: 'functionapp'
  properties: {
    httpsOnly: true
    reserved: false
    serverFarmId: appServicePlan_ResourceId
    siteConfig: {
      alwaysOn: true
      // 指定Windows环境下的.NET Framework版本
      netFrameworkVersion: 'v4.8'
      appSettings: [
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~1'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'dotnet'
        }
        {
          name: 'AzureWebJobsStorage'
          value: 'DefaultEndpointsProtocol=https;AccountName=${storage_name};AccountKey=${listKeys(storage_name.id, '2021-02-01').keys[0].value};EndpointSuffix=${environment().suffixes.storage}'
        }
      ]
    }
  }
  dependsOn: [
    appServicePlan_name
    storage_name
  ]
}

补充说明:如果你实际要部署的是.NET 6而非.NET Framework,需要先将关联的App Service Plan调整为Linux类型,将reserved属性设为true,同时把资源kind值修改为'functionapp,linux',此时原有linuxFxVersion: 'DOTNETCORE|6.0'配置才合法,但该方案无法运行.NET Framework应用。

内容的提问来源于stack exchange,提问作者floormind

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.03 04:51:37