gpt4 book ai didi

c# - CngKey System.Security.Cryptography.CryptographicException 系统找不到 Azure 上指定的文件

转载 作者:行者123 更新时间:2023-12-03 00:38:14 25 4
gpt4 key购买 nike

我尝试从此代码生成 key

CngKey key = CngKey.Import(Convert.FromBase64String(privateKey), CngKeyBlobFormat.Pkcs8PrivateBlob);

它在本地工作正常,但当我部署在我的 Azure 应用程序服务中时。它给了我这个错误:

System.Security.Cryptography.CryptographicException: 系统找不到指定的文件。在 System.Security.Cryptography.NCryptNative.ImportKey(SafeNCryptProviderHandle 提供程序,Byte[] keyBlob,字符串格式)在 System.Security.Cryptography.CngKey.Import(Byte[] keyBlob,字符串 curveName,CngKeyBlobFormat 格式,CngProvider 提供程序)

我在配置中添加了 WEBSITE_LOAD_USER_PROFILE 并将值设置为“1”,但没有任何区别。

谢谢

最佳答案

如果WEBSITE_LOAD_USER_PROFILE = 1不适合您。以下是针对同一问题的解决方法:

  • 在 Portal.azure.com 中打开 Azure 应用服务(Azure 网站)边栏选项卡
  • 转到应用程序设置页面
  • 滚动到应用设置
  • 添加新的条目键:WEBSITE_LOAD_CERTIFICATES,并为其提供一个虚拟(伪造、虚构、随机生成)值。

查看以下类似问题的链接以供引用:

关于c# - CngKey System.Security.Cryptography.CryptographicException 系统找不到 Azure 上指定的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66367406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com