.NET6 isolated function on Windows fails
See original GitHub issueI have a pair of functions in a .net 6.0 v4 project. When running locally they both work as expected - one is a queue trigger and the other is a timer trigger. But when I zip deploy to a function app in Azure, ~only the queue triggered function works. The timer triggered function fails immediately with the following error:~
EDIT: on further investigation, it doesn’t appear that the queue function was working either. I’m starting to think that it’s something about the configuration of the app itself.
Type : System.InvalidOperationException
Total Count : 9
Message : Did not find any initialized language workers
The full callstack is here:
Full Exception :
Exception while executing function: Functions.PcfReader ---> System.InvalidOperationException : Did not find any initialized language workers
at Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcherLoadBalancer.GetLanguageWorkerChannel(IEnumerable`1 rpcWorkerChannels) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcherLoadBalancer.cs : 27
at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher.InvokeAsync(ScriptInvocationContext invocationContext) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs : 389
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters,FunctionInvocationContext context) at /_/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs : 95
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) at /_/src/WebJobs.Script/Description/FunctionInvokerBase.cs : 82
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker`2.InvokeAsync[TReflected,TReturnType](TReflected instance,Object[] arguments) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\VoidTaskMethodInvoker.cs : 20
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs : 52
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 596
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance,ParameterHelper parameterHelper,ILogger logger,CancellationTokenSource functionCancellationTokenSource) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 542
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 320
End of inner exception
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 367
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 108
I can provide the function name and subscription details privately if necessary, thank you.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Did not find functions with language [dotnet-isolated].
However, in our production subscription, the functions 'intermittently' report the error "Did not find functions with language [dotnet-isolated] ...
Read more >Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >Running dotnet-isolated AzureFunction does not work
One of the workaround to resolve this issue: Created Azure Functions (Stack: .Net 6 Isolated) in Visual Studio and run locally:.
Read more >Can't run/debug Azure Function isolated (V4) .NET in Rider ...
Can't run/debug Azure Function isolated (V4) .NET in Rider when using Launch Settings profile. Fails to set the host Follow.
Read more >How to Change an Azure Function Written in .NET from In ...
Login to the Azure Portal and change the FUNCTIONS_WORKER_RUNTIME Configuration value from dotnet to dotnet-isolated. After clicking OK, don't ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This turned out to be an issues with indirectly referenced old packages, configuration, and the publishing profile, all of which were only discoverable in the Kudu logs. The issue can be considered resolved, but some information from the team about if or how the issue could’ve been seen in the portal would be very helpful for future readers.
Issue 1: It was not possible to find any compatible framework version This was caused by Visual Studio’s default publishing profile having a
Deployment modesetting ofFramework-dependent.Resolution Changing the deployment mode in the publishing profile to
Self-containedIssue 2: Did not find any initialized language workers This ended up being a combination of two things:
AzureServiceTokenProviderto use the user-assigned identityMicrosoft.Extensions.Configuration.AzureKeyVaultpulled in an older version ofMicrosoft.Azure.Services.AppAuthentication(1.0.3) which did not support the documented connection string.Resolution Adding the configuration string and then explicitly (rather than indirectly) referencing the most recent version of
Microsoft.Azure.Services.AppAuthenticationThere is a newer library for Key Vault integration but we haven’t had time to investigate usage at this time, or compatibility with functions.
repro.zip
Repro instructions
Download and unzip the attached respro code.
Create a function app with the following settings:
net6.0v4dotnet-isolatedwindowsCreate a user managed identity and assign it to the function. The function should not have a system assigned identity enabled, only the user managed identity.
Create a new key vault instance with RBAC-based access control.
Assign the user identity from step 3 using the
Key Vault Readerrole.In the
Program.cs, replace theAppIdin the string on L28 with theClient Idfrom the user managed identity in step 3.On line 32, replace the first parameter with the URL of the key vault created in step 5.
Publish the function to the function app using the following settings (I did this from Visual Studio 2022):
Release|AnyCPUnet6.0Framework-dependentwin-x64Once the function starts up, it should start failing immediately. In Application Insights,
System.InvalidOperationexceptions should start showing up with the message Exception while executing function: Functions.Repro Did not find any initialized language workersGoing to the Kudu debug console and navigating to the logs under
C:\home\LogFiles\Application\Functions\Hostwill show the error:Observation: The framework error only started appearing once I added the key vault extensions nuget package. Prior to that, the function actually ran as expected.
From the publish profile, change the
Deployment modesetting toSelf-containedand republish the function.Identical errors will appear in Application Insights as in step 10.
Again going to the logs from the Kudu debug console, the error changes to: