C# CommunicationsClientBuilder 通过指纹看不到本地证书

问题描述 投票:0回答:1

在 Azure 外部(本地)执行代码。代码很简单,将app id和name替换为foos:

            var mediaPlatformSettings = new MediaPlatformSettings()
            {
                MediaPlatformInstanceSettings = new MediaPlatformInstanceSettings()
                {
                    CertificateThumbprint = "52d85f98750cee735caba5d9e128c5ff64436d9a",
                    InstanceInternalPort = 80,
                    InstancePublicIPAddress = IPAddress.Any,
                    InstancePublicPort = 80,
                    ServiceFqdn = "mupse.pupse.com"
                },
                ApplicationId = "foo-id"
            };

            var builder = new CommunicationsClientBuilder(
                "foo",     // name
                "foo-id", // app id
                this.Logger);
            builder.SetMediaPlatformSettings(mediaPlatformSettings);

最后一行出现错误:

ArgumentException: CertificateThumbprint
Parameter name: Could not find a matching certificate for thumbprint 52d85f98750cee735caba5d9e128c5ff64436d9a

证书是自签名的,采用 pfx 格式,及其私钥。它与 MMC 实用程序一起安装在个人文件夹中。它的rootCA安装在受信任的根证书文件夹中; MMC 不会将其报告为不安全。

相关证书属性,根据 MMC:

  • 主题:CN = mupse.pupse.com
  • 主题备用名称:DNS 名称=mupse.pupse.com
  • 指纹与 MediaPlatformInstanceSettings 中指定的指纹匹配

因此,CN 和指纹都与存储的内容和代码中的内容相匹配。

尝试过的其他事情:

  • 没有私钥的证书(pem 文件)
  • 在 Azure 中安装此证书,适用于应用程序和键值 商店
  • Azure 中具有正确 CN 的有效非自签名证书 应用程序
  • 从 MMC 获取的不相关的现有证书
  • 其他类似的操作,没有效果

预期结果:不应发生异常,媒体平台应正确配置。

c# ssl microsoft-graph-api bots mmc
1个回答
0
投票

通过在计算机帐户上安装证书解决了问题。顺便说一句,该程序本身是由用户帐户启动的。

© www.soinside.com 2019 - 2024. All rights reserved.