【Function App】本地通过VS Code调试Function时候遇见无法加载文件错误Microsoft.Extensions.Diagnostics.Abstractions

简介: 在使用 VS Code 调试 Azure Functions 时,执行 `func host start` 可能因版本冲突报错。错误信息显示 Rpc Initialization Service 启动失败,可能是由于缺少文件或组件导致。解决方法包括:1) 使用 npm 卸载并重新安装 Azure Functions Core Tools;2) 若问题未解决,重新下载安装包(如 func-cli-x64.msi)修复旧版本工具;3) 退出并重启 VS Code,重新加载项目即可恢复正常运行。参考资料链接提供了更多背景信息。

问题描述

本地调试VS Code函数,在执行 func host start的时候报错:

错误信息:

> func host start

Azure Functions Core Tools

Core Tools Version: 4.0.7317 Commit hash: N/A +5ca56d37938824531b691f094d0a77fd6f51af20 (64-bit)

Function Runtime Version: 4.1038.300.25164

Skipping 'JAVA_HOME' from local settings as it's already defined in current environment variables.

[2025-06-05T11:28:18.312Z] Error starting Rpc Initialization Service. Handling error and continuing.

[2025-06-05T11:28:18.327Z] Microsoft.Azure.WebJobs.Script: Failed to start Rpc Server. Check if your app is hitting connection limits. System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

[2025-06-05T11:28:19.988Z] A host error has occurred during startup operation '3e42ddc0-cd83-41c8-921d-70315100228a'.

[2025-06-05T11:28:19.990Z] System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

[2025-06-05T11:28:20.001Z] Failed to stop host instance 'f6264ddc-95ad-4e41-86d8-44859261268c'.

[2025-06-05T11:28:20.002Z] Microsoft.Azure.WebJobs.Host: The host has not yet started.

Value cannot be null. (Parameter 'provider')

[2025-06-05T11:28:20.753Z] Host startup operation has been canceled

 

如何来解决这个问题呢?

 

问题解答

此问题很可能是由更新后系统中的某些版本冲突引起的。需要尝试重新安装 Azure Functions Core Tools,以确保所有组件均已正确安装。

首先,我们可以使用以下命令卸载并重新安装这些工具:

npm uninstall -g azure-functions-core-tools

npm install -g azure-functions-core-tools@4 --unsafe-perm true

如果以上方法并不能解决这个问题,如下图:

出现这个问题的原因与最初在本机上安装 Azure Function Runtime插件的方式有关,如果当时是下载安装包(如:func-cli-x64.msi)来安装的,则使用npm方式就不可以。

 

可以使用如下步骤解决问题:

1) 从新下载Function Core Tools:(https://docs.azure.cn/zh-cn/azure-functions/functions-run-local?tabs=windows%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-csharp#install-the-azure-functions-core-tools) 并安装修复旧版本Azure Function Core Tools

2)退出VS Code,并重新加载Function项目,启动func host成功!

 

 

参考资料

Error after updating Azure Functions Core Tools to version 4.0.6594:https://learn.microsoft.com/en-us/answers/questions/2118820/error-after-updating-azure-functions-core-tools-to

 

 


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

相关文章
|
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
|
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重新协商机制限制,大请求体无法正常处理,导致此问题。
231 1
|
8月前
|
存储 数据可视化 开发工具
【Application Insights】Application Insights存储的Function App的日志存在"Operation Link" 为空的情况
在将 Azure Functions 升级到 .NET 8 和 Isolated Worker 模式后,Application Insights 的请求日志中 `operation_Link` 字段为空,导致分布式追踪无法正常关联。解决方法包括:确保引用正确的 SDK 包(如 `Microsoft.Azure.Functions.Worker.ApplicationInsights`),正确配置 Application Insights 服务,移除默认日志过滤规则,并使用最新依赖包以支持分布式追踪。通过这些步骤,可恢复端到端事务视图的可视化效果。
187 10
|
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
|
8月前
【Function App】在PowerShell Function中指定特殊的Microsoft.Graph.Users版本
在Azure Function App中运行PowerShell Function时,通过Requirements.psd1文件管理模块版本。若需将“Microsoft.Graph.Users”从最新版2.26.0改回2.23.0以避免冲突,可通过以下步骤解决:1) 在requirements.psd1中明确指定版本为2.23.0 2) 在profile.ps1中添加`Import-Module Microsoft.Graph.Users -RequiredVersion 2.23.0`语句。此方法确保加载特定版本模块
168 18
|
3月前
|
缓存 移动开发 JavaScript
如何优化UniApp开发的App的启动速度?
如何优化UniApp开发的App的启动速度?
772 139
|
3月前
|
移动开发 JavaScript weex
UniApp开发的App在启动速度方面有哪些优势和劣势?
UniApp开发的App在启动速度方面有哪些优势和劣势?
409 137
|
3月前
|
数据采集 JavaScript 前端开发
开发比分App?你缺的不是程序员
开发体育比分App,关键不在代码,而在懂体育、懂数据、懂用户。明确定位、理清需求、选好数据源,再找专业的产品、数据与技术人才协同,才能少走弯路。程序员最后入场,效率最高。
262 154
|
4月前
|
移动开发 小程序 Android开发
基于 uni-app 开发的废品回收类多端应用功能与界面说明
本文将对一款基于 uni-app 开发的废品回收类多端应用,从多端支持范围、核心功能模块及部分界面展示进行客观说明,相关资源信息也将一并呈现。
189 0