{"id":10993,"date":"2024-07-25T04:47:00","date_gmt":"2024-07-25T04:47:00","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=10993"},"modified":"2024-07-25T04:47:00","modified_gmt":"2024-07-25T04:47:00","slug":"dotnet-isolated-azurefunction","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/dot-net\/dotnet-isolated-azurefunction","title":{"rendered":"Running dotnet-isolated AzureFunction Does Not Work"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>You have developed an Azure Function v4 with .NET 6.0 containing only HTTP-triggered functions. While everything works fine locally, deploying the function to Azure results in a 500 Status Code for any endpoint. The error thrown is:<\/p>\n<p>InvalidOperationException at Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcherLoadBalancer.GetLanguageWorkerChannel: Did not find any initialized language workers<\/p>\n<h2>Application Settings<\/h2>\n<p>The current application settings in Azure are configured as follows:<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-10996\" src=\"https:\/\/assets.bacancytechnology.com\/qanda\/wp-content\/uploads\/2024\/07\/25044100\/unnamed.png\" alt=\"azzured app\" width=\"625\" height=\"308\" srcset=\"https:\/\/assets.bacancytechnology.com\/qanda\/wp-content\/uploads\/2024\/07\/25044100\/unnamed.png 625w, https:\/\/assets.bacancytechnology.com\/qanda\/wp-content\/uploads\/2024\/07\/25044100\/unnamed-300x148.png 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h3>Configuration Details:<\/h3>\n<ul>\n<li><strong>Operating System:<\/strong> Windows<\/li>\n<li><strong>Runtime Version:<\/strong> 4.0.1.16815<\/li>\n<li><strong>Location:<\/strong> West Europe<\/li>\n<\/ul>\n<h2>Project File Configuration<\/h2>\n<p>Below is the configuration of your project file (.csproj):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\r\n  &lt;PropertyGroup&gt;\r\n    &lt;TargetFramework&gt;net6.0&lt;\/TargetFramework&gt;\r\n    &lt;AzureFunctionsVersion&gt;v4&lt;\/AzureFunctionsVersion&gt;\r\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\r\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\r\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;\r\n  &lt;\/PropertyGroup&gt;\r\n  &lt;ItemGroup&gt;\r\n    &lt;PackageReference Include=\"AutoMapper.Extensions.Microsoft.DependencyInjection\" Version=\"11.0.0\" \/&gt;\r\n    &lt;PackageReference Include=\"Microsoft.ApplicationInsights\" Version=\"2.20.0\" \/&gt;\r\n    &lt;PackageReference Include=\"Microsoft.Azure.Functions.Worker\" Version=\"1.6.0\" \/&gt;\r\n    &lt;PackageReference Include=\"Microsoft.Azure.Functions.Worker.Extensions.OpenApi\" Version=\"1.0.0\" \/&gt;\r\n    &lt;PackageReference Include=\"Microsoft.Azure.Functions.Worker.Extensions.Http\" Version=\"3.0.13\" \/&gt;\r\n    &lt;PackageReference Include=\"Microsoft.Azure.Functions.Worker.Sdk\" Version=\"1.3.0\" OutputItemType=\"Analyzer\" \/&gt;\r\n  &lt;\/ItemGroup&gt;\r\n  &lt;ItemGroup&gt;\r\n    &lt;None Update=\"host.json\"&gt;\r\n      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;\/CopyToOutputDirectory&gt;\r\n    &lt;\/None&gt;\r\n    &lt;None Update=\"local.settings.json\"&gt;\r\n      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;\/CopyToOutputDirectory&gt;\r\n    &lt;\/None&gt;\r\n  &lt;\/ItemGroup&gt;\r\n&lt;\/Project&gt;\r\n<\/pre>\n<h2>Local Settings Configuration<\/h2>\n<p>Your local.settings.json file is configured as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">{\r\n  \"IsEncrypted\": false,\r\n  \"Values\": {\r\n    \"AzureWebJobsStorage\": \"UseDevelopmentStorage=true\",\r\n    \"FUNCTIONS_WORKER_RUNTIME\": \"dotnet-isolated\",\r\n    \"StorageConnectionString\": \"UseDevelopmentStorage\",\r\n    \"APPINSIGHTS_INSTRUMENTATIONKEY\": \"MyInstrumentationKey\"\r\n  },\r\n  \"Host\": {\r\n    \"LocalHttpPort\": 7071,\r\n    \"CORS\": \"*\"\r\n  }\r\n}\r\n<\/pre>\n<h2>Troubleshooting Steps<\/h2>\n<p><strong>1. Ensure All Dependencies are Updated:<\/strong><br \/>\n-&gt; Ensure all the packages in your .csproj file are up-to-date.<br \/>\n<strong>2. Check Application Settings:<\/strong><br \/>\n-&gt; Verify that the FUNCTIONS_WORKER_RUNTIME is set to dotnet-isolated.<br \/>\n<strong>3. Deployment Issues:<\/strong><br \/>\n-&gt; Redeploy the function to ensure there were no issues during the deployment process.<br \/>\n-&gt; Check the Azure portal logs for more detailed error information.<br \/>\n<strong>4. Function App Configuration:<\/strong><br \/>\n-&gt; Make sure that the Azure Function App is properly configured to support .NET 6.0 and is using the correct runtime version.<br \/>\n<strong>5. Language Workers Initialization:<\/strong><br \/>\n-&gt; Verify if there are any configuration issues preventing the initialization of language workers.<\/p>\n<h2>Additional Resources<\/h2>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-functions\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Official Azure Functions Documentation<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview You have developed an Azure Function v4 with .NET 6.0 containing only HTTP-triggered functions. While everything works fine locally, deploying the function to Azure results in a 500 Status Code for any endpoint. The error thrown is: InvalidOperationException at Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcherLoadBalancer.GetLanguageWorkerChannel: Did not find any initialized language workers Application Settings The current application settings in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10994,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[20],"tags":[],"class_list":["post-10993","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/10993"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=10993"}],"version-history":[{"count":2,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/10993\/revisions"}],"predecessor-version":[{"id":10997,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/10993\/revisions\/10997"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/10994"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=10993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=10993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=10993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}