2012-10-24 130 views
4

使用Service Bus for Windows ServerWindows服務器證書的服務總線無法驗證

我收到以下異常。

消息= X.509證書CN = ***********不在信任的 人存儲區中。 X.509證書CN = ********連鎖建築失敗。 已使用的證書具有不可驗證的 信任鏈。替換證書或更改 certificateValidationMode。已驗證證書的簽名不能爲 。

我特林連接到服務總線另一臺計算機上從我的dev的盒子

這裏是我使用的控制檯應用程序的代碼。

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 AutoGeneratedCA.cer AutoGeneratedCA.cr1

然後我導入這兩個文件期運用默認設置,以我的dev的盒子。

我已將下列項目添加到我的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 這表明有與吊銷服務器出了問題,因爲我還進口證書Revocatin列表我沒有看到,這是我的問題

我還發現this: 哪個鏈接到這個博客post: 我沒有任何成功,隨後的建議。

這個博客Post
建議大家settng的revocationMode =「NOCHECK」也沒有在這個問題上,他的解決方案的影響是惡搞證書吊銷列表

這個博客Post: 建議增加端點行爲禁用certificateValidationMode,我做了,我仍然得到錯誤。

注意:當我在我的開發計算機上託管服務總線時,一切都可以找到。

任何建議,我還沒有嘗試過?

+0

__ will解決此問題但具有安全隱患的另一種方法: http://stackoverflow.com/a/39415887/5869 –

回答

相關問題