我正在编写使用C#运行时(.NET Core)的AWS函数的Alexa技能,并试图使用它们的API连接到Google。它在运行时抛出一个缺失的DLL异常:
“System.Security.Cryptography.CngKeyLite”的类型初始化程序引发了一个异常。 在System.Security.Cryptography.CngKeyLite.ImportKeyBlob(String blobType,Byte[] keyBlob) 在System.Security.Cryptography.RSAImplementation.RSACng.ImportKeyBlob(Byte[] rsaBlob,布尔includePrivate) 在System.Security.Cryptography.RSAImplementation.RSACng.ImportParameters(RSAParameters参数处) 在Google.Apis.Auth.OAuth2.ServiceAccountCredential.Initializer.FromPrivateKey(String privateKey) 在Google.Apis.Auth.OAuth2.DefaultCredentialProvider.CreateServiceAccountCredentialFromParameters(JsonCredentialParameters credentialParameters) 在Google.Apis.Auth.OAuth2.DefaultCredentialProvider.CreateDefaultCredentialFromParameters(JsonCredentialParameters credentialParameters) 在AlexaProjLib.GoogleSheet.Connect() 在AlexaProj.Function.FunctionHandler(SkillRequest输入,ILambdaContext上下文)
内部例外:
无法加载DLL 'ncrypt.dll':找不到指定的模块。
代码:
var credential = GoogleCredential.FromJson(_googleSecret).CreateScoped(_scopes);
Service = new SheetsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = _applicationName,
});我是.NET核心和Lambda的新手--如何正确引用缺失的DLL?
发布于 2017-03-18 13:14:36
问题是我在project.json文件(win10-x64)中定义了一个Windows运行时,这导致了这些运行时错误(AWS在Amazon上运行)。最后通过使用dotnet lambda包编译并运行它,并提供了更多详细信息这里。
发布于 2017-03-12 01:27:12
尝试遵循这个github论坛中提供的说明,因为其他用户也会遇到它。
execute
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
instead of
ln -s /usr/local/Cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dylib /usr/local/lib
ln -s /usr/local/Cellar/openssl/1.0.2h_1/lib/libssl.1.0.0.dylib /usr/local/lib
if you receive "File exists" message ln -sf will do the magic..
ln -sf /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -sf /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/https://stackoverflow.com/questions/42735829
复制相似问题