gpt4 book ai didi

azure - WebRole 中的证书列表为空

转载 作者:行者123 更新时间:2023-12-03 04:37:29 25 4
gpt4 key购买 nike

我正在我的网络应用程序中编写代码,该代码需要列出并搜索网络角色上安装的特定证书。这是我的代码

// using System.Security.Cryptography.X509Certificates;

var store = new X509Store() ;
store.Open(OpenFlags.ReadOnly);
LoggingService.Info(String.Format(
"{0} Certificate(s) are found in store",store.Certificates.Count));
for(int index=0;index<store.Certificates.Count;index++)
{
LoggingService.Info(String.Format(
"Subject:{0}, Thumbprint:{1}",store.Certificates[index].Subject,
store.Certificates[index].Thumbprint));
}
_Certificate = store.Certificates.Find(
X509FindType.FindByThumbprint, this.CertificateThumbprint, false)[0];

现在的问题是,即使证书是通过门户添加到 Web 角色中的,并且也存在于配置文件中。 store.Certificates.Count 为零。此代码在模拟器中完美运行,但不知何故无法列出 Web 角色证书。如何访问 Web 角色上安装的证书?

最佳答案

明白了,我没有在 Store 类中提供任何商店名称和位置,并假设它将在每个商店和位置中搜索,但事实并非如此。然后我提供了商店名称和位置,现在系统能够找到证书。

关于azure - WebRole 中的证书列表为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18519044/

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