问题描述
我有一个尝试在本地运行的 C# Azure Function App.几个月前它以前运行良好,但现在失败了:
I have a C# Azure Function App that I'm trying to run locally. It previously had worked fine some months ago but is now failing with the following:
发生主机错误
Microsoft.Azure.WebJobs.Extensions.Storage:无法从程序集Microsoft.Azure.WebJobs.Host,版本=3.0.3.0,文化=中性,PublicKeyToken=31bf3856ad364e35"加载类型Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter".
A host error has occurred
Microsoft.Azure.WebJobs.Extensions.Storage: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
在某个时候,我已将 Azure Functions 和 Web 作业工具更新到最新版本 (15.10.20460.0).
At some point I had updated the Azure Functions and Web Jobs Tools to the latest version (15.10.20460.0).
在启动时,索引函数时出现问题,因此我将 Microsoft.NET.Sdk.Functions nuget 包引用更新为最新版本 (1.0.24),它现在为我提供了上述内容错误.
On startup, it was having problems indexing the functions so I updated the Microsoft.NET.Sdk.Functions nuget package reference to the latest version (1.0.24) which is now giving me the above error.
我还添加了对 Microsoft.Azure.WebJobs.Extensions.Storage 3.0.3 的 nuget 包引用,以解决同样出现的缺失 TableAttribute
错误.
I also added a nuget package reference to Microsoft.Azure.WebJobs.Extensions.Storage 3.0.3 to resolve the missing TableAttribute
errors that appeared as well.
我检查了 bin 文件夹中具有以下版本的程序集:
I've checked the assemblies in the bin folder which have the following versions:
- Microsoft.Azure.WebJobs.Extensions.Storage.dll - v3.0.3.0
- Microsoft.Azure.WebJobs.Host.dll - v3.0.4.0
推荐答案
将 Microsoft.Azure.WebJobs.Extensions.Storage 的 Nuget 包参考从最新版本 - 3.0.3 更改为 3.0.2 解决了问题.
Changing the Nuget Package Reference for Microsoft.Azure.WebJobs.Extensions.Storage from the latest version - 3.0.3 to 3.0.2 resolves the issue.
现在运行函数项目成功启动,没有显示错误.
Running the function project now launches successfully with no errors displayed.
这篇关于Azure Function App 无法加载 IOptionsFormatter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!