【问题标题】:Azure Function exception could not load ActiveDirectory file or assemblyAzure 函数异常无法加载 ActiveDirectory 文件或程序集
【发布时间】:2018-05-21 08:42:07
【问题描述】:

我正在尝试编写一个将文件写入 Azure Datalake 的 azure timer 函数,但是当我添加所需的 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
  • 嗯,这似乎有效,但你是怎么知道的?

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


【解决方案1】:

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

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

This是类似的问题,你可以参考一下。

【讨论】:

    猜你喜欢
    • 2018-10-13
    • 2018-11-29
    • 2012-03-14
    • 1970-01-01
    • 2018-09-10
    • 2020-11-01
    • 2018-09-12
    • 1970-01-01
    相关资源
    最近更新 更多