gpt4 book ai didi

.net - Azure WindowsCryptographicException : The specified network password is not correct when publishing despite correct password

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

我正在从文件系统上的 pfx 加载 x509 证书

new X509Certificate2(@"Resources\certificate.pfx", "Password123")

在本地,这工作正常,但是当我将其发布到 azure 应用程序服务时,服务器日志显示

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The specified network password is not correct.at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)at Internal.Cryptography.Pal.CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)at IdentityServerAspNetIdentity.Startup.ConfigureServices(IServiceCollection services) in ...

如果我修改密码并尝试在本地运行它,我会收到相同的错误。在发布之前它运行良好。我不太确定是什么原因造成的

最佳答案

要解决此Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException:指定的网络密码不正确错误:

您可以按照 bartonjs (Jeremy Barton) · GitHub 的建议尝试:

尝试设置应用配置设置WEBSITE_LOAD_USER_PROFILE = 1(来自 https://github.com/dotnet/corefx/issues/27358#issuecomment-509961051 )。或者将 cert = new X509Certificate2(privateKeyBytes, (string)null); 更改为 cert = new X509Certificate2(privateKeyBytes, (string)null, X509KeyStorageFlags.EphemeralKeySet);

引用文献:https://github.com/dotnet/runtime/issues/30658#issuecomment-523946164 , https://github.com/dotnet/runtime/issues/25143Loading X509 Certificate: Error in Azure, can't reproduce locally

关于.net - Azure WindowsCryptographicException : The specified network password is not correct when publishing despite correct password,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71315853/

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