【发布时间】:2022-01-23 22:38:58
【问题描述】:
拥有一个用 NodeJS 编写的 Azure Durable Functions 应用程序。由于以下错误,函数可以正常部署到 Azure,但无法在 VSCode 中本地调试它们。我不明白为什么我的应用程序中出现 .NET 核心错误。
MS_FUNCTION_LOGS 2,,,,ErrorOccuredDuringStartupOperation,Host.Startup,"System.Security.Cryptography.CryptographicException : 尝试加密提供的数据时发生错误。有关详细信息,请参阅内部异常。 ---> System.InvalidOperationException:密钥环不包含有效的默认保护密钥。数据保护系统无法创建新密钥,因为密钥的自动生成功能已禁用。
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now,IKey keyJustAdded)
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset 现在)
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow,Boolean forceRefresh)
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRing()
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) 内部异常结束
在 Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext)
在 Microsoft.AspNetCore.DataProtection.DataProtectionCommonExtensions.Protect(IDataProtector 保护器,字符串纯文本)
在 Microsoft.Azure.WebJobs.Script.WebHost.DataProtectionKeyValueConverter.WriteValue(Key key) 在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\DataProtectionKeyValueConverter.cs:59
在 Microsoft.Azure.WebJobs.Script.WebHost.KeyValueConverterFactoryExtensions.WriteKey(IKeyValueConverterFactory factory,Key key) 在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\KeyValueConverterFactoryExtensions.cs:23 在 Microsoft .Azure.WebJobs.Script.WebHost.SecretManager.CreateKey(String name,String secret) 在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:608
在 Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GenerateKey(字符串名称)在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:601
在 Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GenerateHostSecrets() 在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:494
在异步 Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GetHostSecretsAsync() 在 D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:97
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在异步 Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetOrCreateExtensionKey(String extensionName) 在 D:\a\1\s\src\WebJobs.Script.WebHost\WebHooks\DefaultScriptWebHookProvider.cs :74
在 windows 或 ubuntu 开发环境中启动调试时会发生同样的错误。
Azure Functions 核心工具核心工具版本:3.0.3904 函数运行时版本:3.3.1.0
local.settings.json 详细信息:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "node",
"BlobStorageConnection": "UseDevelopmentStorage=true",
"BlobStorageAccountKey": "",
"CONTAINER_NAME": "downloads"
}
}
有没有办法更改某些配置或平面以启用密钥生成和加密密钥的自动刷新,以便系统自行执行此操作而无需开发人员干预?
找到了一个类似的question on stack overflow,但由于我的存储设置为本地模拟器,因此不确定在哪里指定存储帐户详细信息。
谢谢
【问题讨论】:
标签: node.js asp.net-core azure-durable-functions