【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

 

相关文章
|
12月前
|
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
528 13
|
缓存 开发工具 C++
VS Code调试Function报错|无法加载Diagnostics.Abstractions怎么办?
在调试 Azure Function 时,可能出现 “Could not load file or assembly 'Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.0'” 错误,导致主机启动失败。本文详细解析该依赖加载错误的成因,并提供基于不同安装方式(NPM 或 MSI)的解决方案,涵盖重装 Core Tools、清理缓存、检查 .NET SDK 版本等操作步骤,同时提供日志排查与 Docker 容器化替代方案,帮助开发者快速恢复本地调试流程。
439 0
|
存储 安全 数据安全/隐私保护
【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。
473 20
|
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登录问题讨论。
477 6
|
11月前
|
数据安全/隐私保护
【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,以禁用明文输出。
259 1
|
12月前
|
JSON 数据格式
【Azure 环境】当一个Azure Function资源创建很久了,是否可以获取到它的创建时间呢?
用户在尝试获取 Azure Function App 的创建时间时发现,资源 JSON 中缺少 `createdTime` 字段,仅能查看到 `lastModifiedTime`。同时,活动日志和 Azure Resource Graph 查询也未能提供创建时间信息。经解答,Azure 并未为所有资源类型记录创建时间,建议在部署时将创建时间作为标签记录。若创建时间在 90 天内,可通过部署日志间接获取。
323 7
|
网络协议 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重新协商机制限制,大请求体无法正常处理,导致此问题。
364 1
|
JSON C# 数据格式
【Azure Function】C#独立工作模式下参数类型 ServiceBusReceivedMessage 无法正常工作
Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.
388 73
【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
429 64

热门文章

最新文章