【问题标题】:Azure app service: Cannot find the certificate in X509Store(StoreName.My, StoreLocation.CurrentUser)Azure 应用服务:在 X509Store(StoreName.My, StoreLocation.CurrentUser) 中找不到证书
【发布时间】:2017-11-15 10:37:00
【问题描述】:

我编写了一个程序,它需要证书来进行签名和其他一些事情。

我已将我的 pfx 文件作为私有证书上传到我的应用服务的 SSL 证书中。

然后我尝试在我的应用服务上查看已安装的证书,因为它已被描述为 in here 使用 power shell。

但我当前的用户没有任何证书。

我也检查了我的本地机器,但它也不存在。

我也无法使用我的 c# 代码找到它:

 X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
        certStore.Open(OpenFlags.ReadOnly);
        X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, ThumbPrint, false);
        if (certCollection.Count == 0)
            throw new Exception("Certificate not found");

【问题讨论】:

    标签: c# azure ssl azure-web-app-service


    【解决方案1】:

    哦,我忘记在应用设置中添加价值 * 的 WEBSITE_LOAD_CERTIFICATES 了:|

    希望它可以帮助下一个人

    【讨论】:

      【解决方案2】:

      我们可以从这个blog得到答案。

      添加一个名为 WEBSITE_LOAD_CERTIFICATES 的应用设置,并将其值设置为证书的 thumbprint,这样您的 Web 应用程序就可以访问它。

      您可以有多个以逗号分隔的指纹值可以将此值设置为 "*"(不带引号)在这种情况下所有您的证书将被加载到您的 Web 应用程序个人证书存储中。

      【讨论】:

        猜你喜欢
        • 2021-06-27
        • 2020-08-23
        • 2017-12-01
        • 1970-01-01
        • 2012-01-16
        • 1970-01-01
        • 1970-01-01
        • 2015-12-03
        • 1970-01-01
        相关资源
        最近更新 更多