Azure托管服务总线:“X.509证书CN = servicebus.windows.net不在受信任的人员商店中。”
在我的vs2013开发VM上使用Azure SDK 2.3我可以轻松地使用Azure中托管的 Service Bus队列。 但是,在Windows Server 2008 R2 Standard SP1上,看起来Windows无法信任所涉及的证书并引发exception。
抛出的线:
// Send the message await queueclient.SendAsync(message);
exception消息:
X.509证书CN = servicebus.windows.net不在受信任的人员商店中。 X.509证书CN = servicebus.windows.net链建设失败。 使用的证书具有无法validation的信任链。 替换证书或更改certificateValidationMode。 无法将证书链构建到受信任的根颁发机构。
CAPI2日志(附在下面)指向信任问题,因此我比较了两台计算机上安装的证书。 服务器上不存在以下证书:
中级证书颁发机构> Microsoft Internet Authority (由Baltimore CyberTrust Root发布)
中级证书颁发机构> MSIT Machine Auth CA 2 (由Microsoft Internet Authority颁发)
问题:
- 证书来自哪里?
- 为什么他们从服务器中丢失?
- 如何解决这个问题?
可能的路径(更新):
-
在服务器上安装Azure SDK 2.3 for Visual Studio 2013 -
在服务器上安装所有Windows更新
我试过了 :
CAPI2validation链策略事件:
30 0 2 30 0 0x4000000000000001 5642 Microsoft-Windows-CAPI2/Operational ne-r026-310cn A certificate chain could not be built to a trusted root authority.
CAPI2 Build Chain活动:
11 0 2 11 2 0x4000000000000003 5641 Microsoft-Windows-CAPI2/Operational ne-r026-310cn 2014-06-11T19:57:38.998Z A certificate chain could not be built to a trusted root authority.
CAPI2 X509对象事件:
90 0 4 90 0 0x4000000000000200 5640 Microsoft-Windows-CAPI2/Operational ne-r026-310cn servicebus.windows.net MSIT Machine Auth CA 2 redmond corp microsoft com 70DB015B000100008C58 2013-07-27T03:31:06Z 2015-07-27T03:31:06Z *.servicebus.windows.net servicebus.windows.net
缺少的证书是造成例外的原因。
我无法在网上找到证书,我仍然不确定他们是如何设法安装自己但我认为我有一个想法..
我们如何设法获得证书? 我们将Service Bus消息传递代码隔离到控制台应用程序中,并使用生产服务器上的管理员权限执行它。 证书会自动在过程中自行安装。
也许我们的应用程序池在具有有限权限的ApplicationPoolIdentity下运行,不允许Windows下载或安装证书。
此链接似乎提供相关信息: http : //netsekure.org/2011/04/automatic-ca-root-certificate-updates-on-windows/
更新 :您可以在此处下载证书链。
要从Service Bus for Windows Server中消除证书信任问题,请使用以下命令:
创建您信任的证书列表:
var trustedCertificates = new HashSet(new[] { "1245…", "4567…, "8102…" }, StringComparer.OrdinalIgnoreCase);
相信那些:
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => { if (errors == SslPolicyErrors.None) { return true; } var hashString = certificate.GetCertHashString(); var isTrusted = trustedCertificates.Contains(hashString); if (!isTrusted) { telemetryClient.TrackTrace($"Untrusted: {hashString} Errors: {errors} Cert: {certificate.ToString()}", SeverityLevel.Warning); } return isTrusted; };
平静的服务巴士也是:
private static void SetCertificateValidator() { var retriableCertificateValidatorType = Type.GetType("Microsoft.ServiceBus.Channels.Security.RetriableCertificateValidator, Microsoft.ServiceBus", true, false); var instanceProperty = retriableCertificateValidatorType.GetProperty("Instance", BindingFlags.Static | BindingFlags.NonPublic); var instance = instanceProperty.GetValue(null); var peerOrChainTrustNoCheck = retriableCertificateValidatorType.GetField("peerOrChainTrustNoCheck", BindingFlags.Instance | BindingFlags.NonPublic); peerOrChainTrustNoCheck?.SetValue(instance, new EmptyOpX509CertificateValidator()); } private sealed class EmptyOpX509CertificateValidator : X509CertificateValidator { public override void Validate(X509Certificate2 certificate) { } }
- entity framework批量插入虚幻慢
- Azure网站中的站点无法处理X509Certificate2
- 在Visual Studio中更改SQL Server数据库的最大大小以在Azure中上载
- 预编译的Azurefunction和CloudTable绑定输出不起作用
- 未调用AssemblyResolve,并且在序列化期间抛出FileNotFoundException
- 如何使用Azure服务总线主题完成FIFO
- SQL Azure自动地理复制是否会自动进行故障转移?
- 是否可以在不编辑web.config的情况下获得ACS声明?
- IIS应用程序池回收触发器:没有足够的存储空间可用于完成此操作(Azure应用程序服务)