【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found

简介: 【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found

问题描述

VS Code中,已经安装了Azure Function插件,在创建C# Function时候遇见 No .NET worker runtimes found. 如下图:

 

问题解答

最开始看见这个错误,还真的以为是自己的 Function runtime 没有安装,于是在 VS Code 的Terminal窗口执行 func -version, 和 dotnet --version, 都能得到正确返回信息。

#查看func version
func -version
#查看dotnet version
dotnet --version

面对这样的情况,毫无头绪,那里的问题呢? 把VS Code关了又开,开了再关,还改为Run as Administrator模式,都没能解决!

寻求最强网络的帮助,在Google帮助中,找到了在Github的同样的问题:

Internal error: No .NET worker runtimes found when creating C# functions project #3662 : https://github.com/microsoft/vscode-azurefunctions/issues/3662

alexweininger commented on May 13, 2023

The error Internal error: No .NET worker runtimes found. actually has nothing to do with local installations of .NET. I can reproduce this if I configure the "Azure Functions: Project Runtime" setting to ~3 in my global VS Code settings. It works if I leave the setting as the default value (blank) or set it to ~4.

他提到在VS Code的设置中,如果把Function Runtime设置为 ~3, 而我们安装的Function Runtime 为 4.0,就会出现(Internal error:No .NET worker runtimes found)这样的错误。

根据提示,打开Settings --> 查看Function Runtime,被设置为 ~3。根据提示,修改为 ~4 之后,问题解决。

这里被设置为~3 的原因应该是历史遗留问题,在把Function Runtime升级到v3后,没有关注到VS Code中的设置问题。

 

参考资料

Internal error: No .NET worker runtimes found when creating C# functions project : https://github.com/microsoft/vscode-azurefunctions/issues/3662

在 Azure 中使用 Visual Studio Code 创建 C# 函数 : https://docs.azure.cn/zh-cn/azure-functions/create-first-function-vs-code-csharp

 

相关文章
|
5月前
|
API C++
【Azure 环境】VS Code登录China Azure(Function)报错 An error occurred while signing in: invalid_request - AADSTS65002
An error occurred while signing in: invalid_request - AADSTS65002: Consent between first party application 'c27c220f-ce2f-4904-927d-333864217eeb' and first party resource '797f4846-ba00-4fd7-ba43-dac1f8f63013' must be configured via preauthorization - applications owned and operated by Microsoft mus
290 13
|
9月前
|
存储 安全 数据安全/隐私保护
【Azure Function App】在Function App中使用System Managed Identity访问Storage Account
本文介绍了如何在Azure Function中使用托管身份(Managed Identity)替代AzureWebJobsStorage连接函数应用到存储账户,以提高安全性并减少Access Key的使用。具体步骤包括:1) 启用系统分配的身份;2) 为函数应用授予存储访问权限,添加必要角色(如Storage Blob Data Contributor);3) 配置`AzureWebJobsStorage__blobServiceUri`参数指定Blob Service Uri。完成后删除旧配置,即可通过Managed Identity访问Storage Account。
302 19
|
9月前
|
API C++
【Azure Developer】VS Code上登录China Azure遇见错误:CAA20002
在VS Code中安装Azure Resource插件后,修改云环境为中国区Azure时,可能会遇到错误代码CAA20002。解决办法是将Microsoft Account的Client ID Version从默认的v1修改为v2。具体操作为:打开VS Code设置页面“Setting”,输入“microsoft account”过滤配置,在Microsoft中找到Client ID Version并将其值更改为v2。完成后测试登录即可成功。相关参考资料可查阅GitHub上的VS Code Azure登录问题讨论。
266 6
|
4月前
|
数据安全/隐私保护
【Azure Function App】PowerShell Function 执行 Get-AzAccessToken 的返回值类型问题:System.String 与 System.Security.SecureString
将PowerShell Function部署到Azure Function App后,Get-AzAccessToken返回值类型在不同环境中有差异。正常为SecureString类型,但部分情况下为System.String类型,导致后续处理出错。解决方法是在profile.ps1中设置环境变量$env:AZUREPS_OUTPUT_PLAINTEXT_AZACCESSTOKEN=false,以禁用明文输出。
158 1
|
5月前
|
JSON 数据格式
【Azure 环境】当一个Azure Function资源创建很久了,是否可以获取到它的创建时间呢?
用户在尝试获取 Azure Function App 的创建时间时发现,资源 JSON 中缺少 `createdTime` 字段,仅能查看到 `lastModifiedTime`。同时,活动日志和 Azure Resource Graph 查询也未能提供创建时间信息。经解答,Azure 并未为所有资源类型记录创建时间,建议在部署时将创建时间作为标签记录。若创建时间在 90 天内,可通过部署日志间接获取。
224 7
|
6月前
|
网络协议 API 网络安全
【Azure Function App】发现部分请求Function App遇见 403.72 报错(请求Body>100KB)
在调用Azure Function的HTTP Trigger时,发送POST请求偶尔出现403错误,且响应为空、Header信息少。经排查发现,当请求Body大于100KB时会触发403.72错误,原因是启用了“Client Certificate mode”为“Optional Interactive User”。解决方法是将该模式设置为“Ignore”。由于TLS重新协商机制限制,大请求体无法正常处理,导致此问题。
230 2
|
10月前
|
JSON 数据格式
【Azure Fabric Service】演示使用PowerShell命令部署SF应用程序(.NET)
本文详细介绍了在中国区微软云Azure上使用Service Fabrics服务时,通过PowerShell命令发布.NET应用的全过程。由于Visual Studio 2022无法直接发布应用,需借助PowerShell脚本完成部署。文章分三步讲解:首先在Visual Studio 2022中打包应用部署包,其次连接SF集群并上传部署包,最后注册应用类型、创建实例并启动服务。过程中涉及关键参数如服务器证书指纹和服务端证书指纹的获取,并附带图文说明,便于操作。参考官方文档,帮助用户成功部署并运行服务。
340 73
|
8月前
|
安全 Linux 开发工具
【Azure Function】分享把Function App从.NET 6.0升级到.NET 8.0 Isolated的步骤
本文介绍了将Azure Function App从.NET 6.0升级到.NET 8.0 Isolated的步骤。.NET 6.0作为长期支持版本,生命周期至2024年11月结束。为确保持续支持,建议升级至更新版本。升级步骤包括安装.NET 8 SDK、更新Azure Functions Core Tools、修改项目文件目标框架为net8.0、更新兼容的NuGet包、本地测试以及重新发布到Azure。更多详细信息可参考官方文档。
385 9
|
12月前
|
C#
【Azure Function】Function App出现System.IO.FileNotFoundException异常
Exception while executing function: xxxxxxx,The type initializer for 'xxxxxx.Storage.Adls2.StoreDataLakeGen2Reading' threw an exception. Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the
319 64

热门文章

最新文章