azure-functions-dotnet-worker: Isolated Process Azure function v4 with .net 6 fails on AKS (linux)
We have multiple function apps running fine with .net core 3.1 and currently hosted in AKS (linux). We are moving all of the apps to .net 6 and func v4. While this works locally pretty good, its not same once deployed to azure environment with below error. While we dont have any direct dependency on the framework ‘<FrameworkReference>’ but we do have multiple asp.net related packages
error
info: Host.Startup[314]
Loading functions metadata
info: Host.Startup[315]
8 functions loaded
info: Host.Startup[0]
Generating 8 job function(s)
info: Host.Function.Console[0]
It was not possible to find any compatible framework version
info: Host.Function.Console[0]
The framework 'Microsoft.AspNetCore.App', version '6.0.0' (x64) was not found.
info: Host.Function.Console[0]
- No frameworks were found.
info: Host.Function.Console[0]
info: Host.Function.Console[0]
You can resolve the problem by installing the specified framework and/or SDK.
info: Host.Function.Console[0]
info: Host.Function.Console[0]
The specified framework can be found at:
info: Host.Function.Console[0]
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=6.0.0&arch=x64&rid=debian.11-x64
// DELETED Messages //
info: Host.Startup[413]
Host started (959ms)
info: Host.Startup[0]
Job host started
Hosting environment: Production
Content root path: /home/site/wwwroot
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
info: Host.General[337]
Host lock lease acquired by instance ID '00000000000000000000000077302ED5'.
fail: Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker[0]
Final functionDispatcher state: WorkerProcessRestarting. Initialization timed out and host is shutting down
fail: Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker[0]
Final functionDispatcher state: WorkerProcessRestarting. Initialization timed out and host is shutting down
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
DrainMode mode enabled
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
Requesting cancellation for function invocation 'c5a5fd42-a17f-4893-9d20-21859e1a21ec'
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
Requesting cancellation for function invocation '6e447eb8-08ec-4d6b-92f3-e958c6ceeb90'
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
Requesting cancellation for function invocation '6a07fa27-d2c8-4dac-9bf0-4a5711b64b93'
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
Requesting cancellation for function invocation '10a87052-fb25-4480-a30e-e8b6a95e881d'
info: Microsoft.Azure.WebJobs.Host.DrainModeManager[0]
Calling StopAsync on the registered listeners
This is the csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RuntimeIdentifiers>win-x86;win-x64;win-arm;linux-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<UserSecretsId>r98c7709-6050-4530-bd33-ed0et8b1b448</UserSecretsId>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
<DockerFastModeProjectMountDirectory>/home/site/wwwroot</DockerFastModeProjectMountDirectory>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup>
// some business related projects referred here, all targeting either .net 6 or .net core 3.1
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Azure.Identity" Version="1.5.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.6.2" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
<PackageReference Include="Polly" Version="7.2.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
<PackageReference Include="Microsoft.Azure.EventGrid" Version="3.2.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.EventHubs" Version="4.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="4.2.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="3.0.9" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="4.0.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
ADO command to package the app is dotnet publish -o /SomeOutputPath -c release
(using linux agents)
docker file format is below (where we copy from already published folder ‘SomeOutputPath’ (this is to avoid nuget restore auth etc inside docker build for now)
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated6.0 AS base
WORKDIR /home/site/wwwroot
EXPOSE 80
COPY SomeOutputPath .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
Even if we use FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base
image, its same error.
All the AKS pods have env variable set as FUNCTIONS_WORKER_RUNTIME=dotnet-isolated
Is this a known issue? Any help appreciated.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (5 by maintainers)
The fix is available in the app service image. You could use that as the base image.
mcr.microsoft.com/azure-functions/dotnet-isolated:4.1.3-dotnet-isolated6.0-appservice
Non app service images are still not ready yet.
@sanjaydebnath Not yet. There was a deployment freeze last week due to holidays. I will post an update in this thread when the deployment is done, and images are available.
@sanjaydebnath Sorry! Deployment took more time than originally anticipated. Deployment is currently in progress. I will share an update here when it is completed. Thank you for your patience.
I was able to get things runnings this weekend:
dotnet
todotnet-isolated
.az functionapp config set --name <FUNCTION_APP> --resource-group <RESOURCE_GROUP> --linux-fx-version 'DOTNET-ISOLATED|6.0'
. https://docs.microsoft.com/en-us/azure/azure-functions/set-runtime-version?tabs=azurecli#manual-version-updates-on-linuxGood luck!