Azure Functions 1.0.7提供使用EF Core 2无法加载文件或程序集错误 [英] Azure Functions 1.0.7 giving Could not load file or assembly error with EF Core 2

查看:93
本文介绍了Azure Functions 1.0.7提供使用EF Core 2无法加载文件或程序集错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将某些功能移至Azure Functions.为EF Core 2代码创建了一个项目,并将其引用到Azure Functions项目.将EF Core + SQLServer块软件包添加到Azure Functions项目.当函数尝试执行时,这是屏幕中的错误.我可以看到Microsoft.EntityFrameworkCore程序集与我们的Azure函数dll位于同一目录中.

I'm trying to move some functionality to Azure Functions. Created a project for EF Core 2 code, and referenced it to the Azure Functions project. Added the EF Core+SQLServer nugget packages to the Azure Functions project. When the function attempts to execute, this is the errors in the screen. I can see that the Microsoft.EntityFrameworkCore assembly is in the same directory as our azure functions dll.

任何人都可以阐明为什么找不到它以及如何解决这个问题吗?

Can anyone shed some light on why it's not finding it and how to fix this?

[1/3/2018 6:49:56 AM] A ScriptHost error has occurred
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM] Function completed (Failure, Id=56ba500b-7c3a-45c1-a9eb-8be4d52d1592, Duration=159ms)
[1/3/2018 6:49:56 AM]
[1/3/2018 6:49:56 AM] Executed 'Accounting' (Failed, Id=56ba500b-7c3a-45c1-a9eb-8be4d52d1592)
[1/3/2018 6:49:56 AM] System.Private.CoreLib: Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM]   Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '56ba500b-7c3a-45c1-a9eb-8be4d52d1592'
[1/3/2018 6:49:56 AM] System.Private.CoreLib: Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.  

更新:2018/1/3
我已经安装了VS 2017 15.5.2,并且正在VS中构建它.

Update: 1/3/2018
I have VS 2017 15.5.2 installed, and I am building this in VS.

这是我从VS运行功能主机时的输出.

Here is the output of the function host when I run it from VS.

[1/4/2018 3:47:03 AM] Host configuration file read:
[1/4/2018 3:47:03 AM] {
[1/4/2018 3:47:03 AM] }
[1/4/2018 3:47:04 AM] Generating 1 job function(s)
[1/4/2018 3:47:04 AM] Starting Host (HostId=jlt03-962556955, Version=2.0.11353.0, ProcessId=21200, Debug=False, Attempt=0, FunctionsExtensionVersion=)
[1/4/2018 3:47:04 AM] Found the following functions:
[1/4/2018 3:47:04 AM] Jobs.Accounting.Run
[1/4/2018 3:47:04 AM]
Listening on http://localhost:7071/  

推荐答案

因此,在进行了更多搜索之后,我遇到了

So after much much more searching, I came across this GitHub posted issue. It is the exact same issue that I am seeing here. Apparently it is a issue with Azure Functions 1.0.7 and EF Core 2.0.1.

我必须将AF的角色恢复为1.0.6 并且,我还必须将EF Core的角色恢复为2.0.0.之后,该功能将按预期执行.

I had to role back AF back to 1.0.6 AND I also had to role EF Core back to 2.0.0. Afterwards the function executed as expected.

我将监视GitHub问题,并在确认已解决此问题后对其进行更新.

I will be monitoring the GitHub issue and update this answer once it is confirmed to be fixed.

更新
现在,此问题已在Azure Functions核心工具2.1.0发行版中得到修复.
https://github.com/Azure/app-service-announcements/issues/109

Update
This is now fixed with Azure Functions Core Tools 2.1.0 release.
https://github.com/Azure/app-service-announcements/issues/109

这篇关于Azure Functions 1.0.7提供使用EF Core 2无法加载文件或程序集错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆