0

我们有 Azure Web App 服务,它被配置为有一个自定义域,比如“https://test.contosa.com”。我在我的网络应用程序中使用以下代码从商店检索证书。

using (X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))
{
    certStore.Open(OpenFlags.ReadOnly);

    X509Certificate2Collection certCollection = certStore.Certificates.Find(
                                X509FindType.FindByThumbprint,
                                "<<MY_CERTIFICATE_THUMBPRINT>>",
                                false);

    X509Certificate2 certificate = certCollection.OfType<X509Certificate2>().FirstOrDefault();

    if (certificate != null)
    {
        // Using the certificate here for generating and reading token
    }
}

现在,当我使用 Web 应用程序 URL“http://test.azurewebsites.net”时,我可以获取证书。

我们已经基于此链接为自定义域添加了证书绑定。

但是当我使用自定义域“https://test.contosa.com”时,它无法从商店中找到证书。如何搜索自定义域的证书?提前致谢。

4

0 回答 0