Search code examples
.netazure.net-coreazure-appserviceazure-app-service-plans

Cannot run .NET Core application on Linux in Azure App Services with linuxFxVersion: 'DOTNETCORE:8.0'


When I define my .NET Core application to run on Linux in Azure App Services with linuxFxVersion: 'DOTNETCORE:8.0' and reserved: true, I keep getting HTTP 404 responses from Nginx.

The application works fine on Windows in Azure App Services.

Looking at the logs, it seems like App Services is downloading a PHP image, which outputs a version of PHP 8.0.x.

Has anyone experienced something similar and knows how to fix it?

enter image description here

Code:

resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
  name: appServicePlanName
  location: location
  sku: environmentConfigurationMap[environment].appServicePlan.sku
  properties: {
    reserved: true
  }
  kind: 'linux'
}

resource appServiceApp 'Microsoft.Web/sites@2022-03-01' = {
  name: appServiceAppName
  location: location
  identity: { type: 'SystemAssigned' }
  properties: {
    serverFarmId: appServicePlan.id
    httpsOnly: true
    siteConfig: {
      linuxFxVersion: 'DOTNETCORE:8.0'
      // netFrameworkVersion: 'v8.0'
      appSettings: [
        {
          name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
          value: applicationInsights.properties.InstrumentationKey
        }
        {
          name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
          value: applicationInsights.properties.ConnectionString
        }
      ]
    }
  }
}

Error:

enter image description here

enter image description here


Solution

  • The right syntax for setting a .NET version in linuxFxVersion is DOTNETCORE|x.x, even for .NET 6 or .NET 8.

    So instead of:

    DOTNETCORE:8.0
    

    Use:

    DOTNETCORE|8.0