<分区>
使用 Service Bus for Windows Server
我得到以下异常。
Message=The X.509 certificate CN=*********** is not in the trusted people store. The X.509 certificate CN=******** chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. The signature of the certificate cannot be verified.
我正在尝试从我的 Dev Box 连接到另一台计算机上的服务总线
这是我正在使用的控制台应用程序的代码。
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(ValidateServerCertificate);
ServicePointManager.CheckCertificateRevocationList = false;
NamespaceManager namespaceManager = NamespaceManager.Create();
MessagingFactory messagingFactory = MessagingFactory.Create();
if (namespaceManager.QueueExists(QueueName))
{
namespaceManager.DeleteQueue(QueueName);
}
namespaceManager.CreateQueue(QueueName);
string QueueName = "ServiceBusQueueSample";
QueueClient myQueueClient = messagingFactory.CreateQueueClient(QueueName);
BrokeredMessage sendMessage = new BrokeredMessage("Hello World !");
myQueueClient.Send(sendMessage); <---- !!!Exception!!!
我从服务总线服务器导出了证书 使用:获取 SBAutoGeneratedCA 自动生成的CA.cer 自动生成的CA.cr1
然后我使用默认设置将这两个文件导入到我的开发箱中。
我已将以下项目添加到我的 app.config 中。
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior >
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None"
revocationMode="NoCheck" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<microsoft.identityModel>
<service>
<certificateValidation certificateValidationMode="None" />
</service>
</microsoft.identityModel>
我能够成功验证并检查队列是否存在并将其删除然后创建一个新队列。
在寻找解决方案时,我找到了 this 建议吊销服务器有问题,因为我还导入了证书吊销列表我没有看到这是我的问题
我还找到了this : 哪个链接到这个博客post : 我听从了这个建议,但没有成功。
此博客 Post :
建议设置revocationMode="NoCheck"对此问题没有影响,他的解决方案是欺骗证书吊销列表
此博客 Post : 建议添加端点行为以禁用 certificateValidationMode,我做了但仍然收到错误。
注意:当我在我的开发机器上托管服务总线时,一切正常。
有什么我没有尝试过的建议吗?