c# - Azure Function 异常无法加载 ActiveDirectory 文件或程序集

标签 c# azure azure-functions azure-data-lake

我正在尝试编写一个将文件写入 Azure Datalake 的 azure 计时器函数,但是当我添加所需的 nuGet 包时,启动主机时出现错误

错误如下

[21/5/2018 8:36:20 AM] Executed 'NWPimFeederFromAws' (Failed, Id=03395101-41a5-44ef-96d8-f69c5d73eca7)
[21/5/2018 8:36:20 AM] System.Private.CoreLib: Exception while executing function: NWPimFeederFromAws. NWPimFeeder: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.5.13701, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.5.13701, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

我的类中的 using 语句如下所示

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.DataLake.Store;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest.Azure.Authentication;

我无法找到为什么会发生这种情况,任何指示表示赞赏

我的主机版本如下

Hosting environment: Production
Content root path: C:\Users\MattDouhan\source\repos\NWPimFeeder\NWPimFeeder\bin\Debug\netstandard2.0
Now listening on: http://localhost:7071
Application started. Press Ctrl+C to shut down.
[21/5/2018 8:36:17 AM] Reading host configuration file 'C:\Users\MattDouhan\source\repos\NWPimFeeder\NWPimFeeder\bin\Debug\netstandard2.0\host.json'
[21/5/2018 8:36:17 AM] Host configuration file read:
[21/5/2018 8:36:17 AM] {}
[21/5/2018 8:36:17 AM] Starting Host (HostId=desktop7cks1do-1525525221, InstanceId=8ef074ac-f031-4591-983d-d590041bd1c9, Version=2.0.11651.0, ProcessId=7060, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)

最佳答案

这似乎是由库错误引起的。

您可以将 Microsoft.IdentityModel.Clients.ActiveDirectory 版本降级至 3.14.0。

This有类似问题,可以引用一下。

关于c# - Azure Function 异常无法加载 ActiveDirectory 文件或程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50444973/

相关文章:

c# - 如何禁止 WebView 在 WinRT 中打开浏览器上的链接(target=_blank links)?

c# - 通过 UpdateAsync 方法从移动服务接收千兆数据

c# - Azure Blob 存储 | AcquireLeaseAsync,同步等待直到锁释放

c# - Azure 函数失败,并显示无用的错误消息“值不能为空”。参数名称: value

c# - 从 Azure 下载文件的 Web 服务会引发大文件异常

c# - 需要一些正则表达式帮助

c# - ASP.NET Core 2.0 LDAP 事件目录身份验证

c# - Entity Framework 选择查询

azure - 如何监控 Azure 事件中心消费者延迟?

azure - Ansible 部署 Azure Function