Azure 函数 - 无法为运行时启动新的语言工作者:dotnet-isolated [英] Azure Function - Failed to start a new language worker for runtime: dotnet-isolated
问题描述
我有一个 dotnet 5 函数应用程序,我已经从 devops 管道构建和部署了几周.
I have a dotnet 5 function app that I've been building and deploying from a devops pipeline for a couple of weeks.
在最新版本之后,我在 App Insights 中看到以下错误:
Following the most recent release, I see the following error in App Insights:
异常类型 System.TimeoutException异常消息 操作已超时.日志级别错误prop__{OriginalFormat} 无法为运行时启动新的语言工作者:dotnet-isolated.类别 Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcherSystem.TimeoutException:操作已超时.在 Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.StartWorkerProcessAsync()
Exception type System.TimeoutException Exception message The operation has timed out. LogLevel Error prop__{OriginalFormat} Failed to start a new language worker for runtime: dotnet-isolated. Category Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher System.TimeoutException: The operation has timed out. at Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.StartWorkerProcessAsync()
csproj 文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<UserSecretsId>4f786da6-0d47-4ccc-b343-638a6e34e1cf</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Remove="local.settings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Abstractions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="4.0.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.3" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
<PackageReference Include="NSwag.AspNetCore" Version="13.11.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..infrastructureSmsRouter.GovNotifySmsRouter.GovNotify.csproj" />
<ProjectReference Include="..SmsRouter.InfrastructureSmsRouter.EntityFramework.csproj" />
<ProjectReference Include="..SmsRouter.UtrnSmsRouter.Utrn.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
host.json:
{
"version": "2.0"
}
功能应用配置:
[
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "<my key is here>",
"slotSetting": true
},
{
"name": "AzureWebJobsStorage",
"value": "DefaultEndpointsProtocol=https;AccountName=storesmsroutermsdn;AccountKey=<my key is here>;EndpointSuffix=core.windows.net",
"slotSetting": false
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "DefaultEndpointsProtocol=https;AccountName=storesmsroutermsdn;AccountKey=<my key is here>;EndpointSuffix=core.windows.net",
"slotSetting": false
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "func-smsrouter-msdn-01b300",
"slotSetting": false
},
{
"name": "WEBSITE_ENABLE_SYNC_UPDATE_SITE",
"value": "true",
"slotSetting": false
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1",
"slotSetting": false
}
]
函数定义
[Function("HttpExample")]
public static HttpResponseData Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req,
FunctionContext executionContext)
{
var response = req.CreateResponse(HttpStatusCode.OK);
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
response.WriteString("Welcome to Azure Functions!");
return response;
}
还有其他人遇到过这个问题吗?
Has anyone else run into this problem?
注意:我现在已经通过 Azure 门户为此创建了一个支持票证 - ID 是 2106280050000196.Github 问题 这里
Note: I have now created a support ticket for this via the Azure Portal - the id is 2106280050000196. Github issue here
根据@Kaylan 的建议,我使用 Azure CLI 创建了一个带有 --runtime dotnet-isolated 参数的新函数应用程序.然后我将我的函数部署到其中(使用带有 Deploy Azure Function 任务的 devops 管道),但恐怕我会继续看到同样的错误.
Following the suggestion from @Kaylan, I used Azure CLI to create a new function app with --runtime dotnet-isolated param. I then deployed my functions into this (using devops pipeline with the Deploy Azure Function task) but I'm afraid I continue to see the same error.
我也尝试部署到固定应用服务计划(而不是消费),但仍然遇到同样的问题.
I've also tried deploying to a fixed app service plan (rather than consumption) but continued to hit the same problem.
推荐答案
我得到这个问题是因为我已经从一个正常"移动了.dotnet 服务,需要将 FUNCTIONS_WORKER_RUNTIME
从 dotnet
调整为 dotnet-isolated
:
I got this propblem because I'd moved form a "normal" dotnet service and needed to tweak the FUNCTIONS_WORKER_RUNTIME
from dotnet
to dotnet-isolated
:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
....
}
}
这篇关于Azure 函数 - 无法为运行时启动新的语言工作者:dotnet-isolated的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!