【发布时间】:2019-10-20 02:50:39
【问题描述】:
我有一个 .net 核心应用程序作为控制台,我正在尝试从 Azure Db 获取一些值。 此代码在 .NET Framework(标准)上完美运行,我总是能得到我的数据,但我需要使用 .NET Core。简而言之,我有一种方法可以从另一个(.dll)GetConfig 并且每次我得到异常:
System.AggregateException: 'One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.)'
我知道 .NET Core 有 System.Core,但它没有“SHA256Cng”,只有“SHA256”。也许我可以使用 .net 框架 .dll 还是有其他方法可以解决这个问题? PS。只需使用 .NET Core(.net 控制台应用程序和其他)。
谢谢。
public ITenantConfigurationProvider CreateTenantConfigurationProvider(ITenantClient client, string tenantId)
{
return client.GetConfigAsync(tenantId).Result;
}
【问题讨论】:
-
你对 ddl 有控制权吗?您还需要更改 ddl 中的引用以指向 nuget 包。因为目前它试图从
System.Core获取SHA256Cng,而对于.net 核心,SHA256Cng不在system.coredll 中 -
好的,怎么做?我找不到它:(
标签: c# azure dll .net-core sha256