2014-09-09 17 views
14

Tôi có một số trang web chạy trong Azure, sử dụng mạnh mẽ ServiceBus (cũng được lưu trữ trong Azure), tất cả trong một khu vực.Lỗi ServiceBus định kỳ "Chứng chỉ X.509 CN = servicebus.windows.net không nằm trong cửa hàng người đáng tin cậy" khi sử dụng Azure WebSites

Đôi khi (một lần mỗi 2-3 ngày) Tôi có cùng một lỗi trong tất cả các trang web cùng một lúc (trong đọc/chờ đợi thông điệp):

Microsoft.ServiceBus.Messaging.MessagingCommunicationException: 
The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. 
    The X.509 certificate CN=servicebus.windows.net chain building failed. 
    The certificate that was used has a trust chain that cannot be verified. 
    Replace the certificate or change the certificateValidationMode. 
    A certificate chain could not be built to a trusted root authority. 

Full stacktrace:

Microsoft.ServiceBus.Messaging.MessagingCommunicationException: The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority. 
---> System.ServiceModel.Security.SecurityNegotiationException: The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority. 
---> System.IdentityModel.Tokens.SecurityTokenValidationException: The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority. 

    at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) 
    at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) 
    at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult) 
    at System.ServiceModel.Channels.SslStreamSecurityUpgradeInitiator.InitiateUpgradeAsyncResult.OnCompleteAuthenticateAsClient(IAsyncResult result) 
    --- End of inner exception stack trace --- 

Server stack trace: 
    at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.CreateChannelAsyncResult.<GetAsyncSteps>d__7.MoveNext() 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
    at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result) 

Exception rethrown at [0]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.OnEndCreateInstance(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__2(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 

Exception rethrown at [1]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass17.<GetAsyncSteps>b__a(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 

Exception rethrown at [2]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 

Exception rethrown at [3]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.CloseOrAbortLinkAsyncResult.<GetAsyncSteps>b__7(CloseOrAbortLinkAsyncResult thisPtr, IAsyncResult a) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 

Exception rethrown at [4]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.AbandonPrefetchedMessagesCloseAbortAsyncResult.<GetAsyncSteps>b__41(AbandonPrefetchedMessagesCloseAbortAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 

Exception rethrown at [5]: 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.OnEndClose(IAsyncResult result) 
    --- End of inner exception stack trace --- 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.OnEndClose(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.ClientEntity.OnClose(TimeSpan timeout) 
    at Microsoft.ServiceBus.Messaging.ClientEntity.Close(TimeSpan timeout) 
    at Olekstra.Common.QueueReader.<>c__DisplayClass3.<StartTask>b__2(Boolean force) 

Tôi đang sử dụng phiên bản cập nhật của Microsoft.ServiceBus.dll gói NuGet (2.4.0.0), vì vậy câu trả lời từ "xác thực chứng chỉ của Google bị tắt theo mặc định trong ServiceBus 1.8" là vô ích - tôi chưa chuyển bất kỳ xác thực nào thành BẬT, và hơn thế nữa - nó hoạt động nhiều giờ liên tục và không chỉ một lần 2-3 ngày một lần.

Tương tự answer về các ứng dụng tự lưu trữ không phù hợp - trang web đang chạy bên trong Azure, máy chủ lưu trữ được quản lý bởi nhân viên MS, tôi không được phép cập nhật bất kỳ chứng chỉ gốc nào.

Có ai biết tại sao khách hàng ServiceBus quyết định kiểm tra SSL cert đôi khi và cách vô hiệu hóa hành vi này không?

UPD:

tôi thêm <add key="Microsoft.ServiceBus.X509RevocationMode" value="NoCheck"/> trong appSettings trong web.config hai tuần trước - không có sự khác biệt.

Cũng Reflector cho thấy giá trị 'nocheck' là mặc định trong Microsoft.ServiceBus.Configuration.ConfigurationHelpers.GetCertificateRevocationMode()

+1

Bạn đã bao giờ có được bất cứ nơi nào với vấn đề này? – Ian1971

Trả lời

5

Một sự thay đổi trong kết nối Chế độ thể giải quyết vấn đề của bạn.

ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https 

Nó thường ConnectivityMode.AutoDetect

Theo một nguồn tin trong hỗ trợ MS

"Điều này sẽ buộc tất cả lưu lượng sử dụng một đường hầm WebSockets đó là bảo vệ bởi một trước TLS/Bắt tay HTTPS và bắt tay đó mang chứng chỉ trung gian được yêu cầu. Giao thức nhắn tin được sử dụng thông qua đường hầm đó sẽ vẫn là AMQP hoặc NetMessagi ng, vì vậy bạn nên không phải lo lắng để có được đặc điểm HTTP khi chọn tùy chọn này. "

Vì vậy, tôi cho rằng chứng chỉ sẽ chỉ được tìm nạp một lần trong trường hợp này và có thể giới thiệu độ trễ bổ sung tại thời điểm đó và sau đó được sử dụng mãi mãi sau đó. Nó có vẻ hợp lý rằng nguy cơ nhận được ngoại lệ của bạn do đó giảm đáng kể.

1

Một cách tiếp cận mà sẽ giải quyết vấn đề này, nhưng có ý nghĩa an ninh: https://stackoverflow.com/a/39415887/5869

+0

Thật không may là không. Tôi không thể tạo danh sách chứng chỉ "đáng tin cậy" vì tất cả chứng chỉ được quản lý bởi MS/Azure và được thay đổi/xoay mà không cần thông báo. – Dmitry

Các vấn đề liên quan